My string is std::string str ("DDWD");
I want to change the corresponding to the following
D = [0-9] W = [a-z]
soo...("[0-9][0-9][A-Z][0-9]")
The replace method does not seem to accomade this, so i tried something like
string tmp = "DDDWD";
int len = 0;
len = tmp.length();
for( int i = 0; i < len; i++ )
{
if ( tmp[i] == 'D')
{
tmp.replace(i,1,"[0-9]");
i+=2;
}
}
However trying to change both letters D and W there was a problem and it wasent changing them all correctly?
Does anyone know a way how to change each letter at the same time to the corresponding string above?
Thankful for any help