On 2011-03-22 at 21:38:13 [+0100], clemens.zeidler@xxxxxxxxxxxxxx wrote: > - int32 endCount = 0; > - while (isspace(string[Length() - endCount - 1])) > + uint32 endCount = 0; > + while (endCount < originalLength - startCount > + && iswspace(string[originalLength - endCount - 1])) { > endCount++; > + } The iswspace() issue was already pointed out. Just as a general hint for loops like that, it is usually easier to read and more efficient to use a direct index: int32 endIndex = Length() - 1; while (endIndex >= startCount && isspace(string[endIndex])) endIndex--; Or, if you like pointers: const char* start = string; while (isspace(*start)) start++; const char* end = string + Length() - 1; while (end >= start && isspace(*end)) end--; CU, Ingo