"Mikael S. H." <mi****@alminde.org> wrote in message
news:43**********************@nntp02.dk.telia.net. ..
I there a function in the string class to replace an 'a' with an 'm', or
something similar?
Will I have to write a function iterating over every character in the
string to rot-13 encoding a string?
--
MikaelSh
std::string MyString = "This is a test. 123. $%*"
for ( int i = 0; i < MyString.length(); ++i )
MyString[i] = MyString[i] + 13;
This should do it, and I don't beleive you even have to worry about
overflow.
I think you could use the for_each also, but I don't use those so don't know
the correct syntax.
Of course, the only thing I know about rot-13 is that it adds 13 to the
characters. I think it does special cases for unprintable characters (0 to
25?) and other ones so it can be sent as pure text. You'll need to get the
full details of rot-13 to find the specifics.