Hello, anyone familiar with ansiString?

Have a problem involving a string "1 1", should read "11".

I want to get rid of the space in the middle. Can't change it to a character string or std::string so that isn't an option. Will i have to compare each character inturn with " "?

Using ansiString.Pos(" ") to get position of the " ", but how should i go about removing the space and replacing it with the next character?

OK here is what I've got at the minute:

String fixString(inputString)
    result = inputString;
    int string_size = result.Length();
    while(result.Pos(" "))
        int space = result.Pos(" ");
        for (int i = space; i < string_size; i++)
             result[space] = result[space+1];
    return result;

Isn't std::string the ANSI string?

Why are you not using std::string? If you were you could just do...

result.erase(result.find(' '));

To remove one space...


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.