I've tried all kinds of things. Unfortunately, I don't keep previous records of code so I'll just show you what I have currently:
string l2n(std::string input) {
std::string original[26] = {"A","B","C","D","E", "F", "G", "H", "I", "J", "K," "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
//std::string originalLower[26] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
std::string newval[26] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26"};
string neworig = (original[0], original[1], original[2], original[3], original[4], original[5], original[6], original[7], original[8], original[9], original[10], original[11], original[12], original[13], original[14], original[15], original[16], original[17], original[18], original[19], original[20], original[21], original[22], original[23], original[24], original[25]);
string newnewval = (newval[0], newval[1], newval[2], newval[3], newval[4], newval[5], newval[6], newval[7], newval[8], newval[9], newval[10], newval[11], newval[12], newval[13], newval[14], newval[15], newval[16], newval[17], newval[18], newval[19], newval[20], newval[21], newval[22], newval[23], newval[24], newval[25]);
size_t posit = input.find(neworig.c_str());
string hash2345;
hash2345 = input.replace(posit, std::string(neworig).length(), newnewval.c_str());
return hash2345;
}
That compiles fine, but outputs "26HELLO" with my input "HELLO". It literally just appends 26 to the beginning of any input given..I'm guessing it has something to do with the usage of input.replace using the length, but I don't know what else to do and google isn't finding anything. Thanks for your help!
neworigandnewnewvalrespectively, what is it that you think those lines are supposed to be doing?neworigis the value oforiginal[25], and the value ofnewnewvalis the value ofnewval[25]. Look up the comma operator. Did you mean to concatenate the strings together? Then useoperator+oroperator+=. Also, a for loop.