Удаление пробелов в начале и в конце:
X++:
public static str trimString(str _str, container _trimStr = [" "])
{
int counter;
str lTrim = _str;
str rTrim;
//удаление пробелов в начале
for(counter = strlen(_str); counter >= 1 ; counter--)
{
if(confind(_trimStr, strdel(lTrim, 1, counter - 1)))
{
lTrim = strdel(lTrim, counter, strlen(lTrim));
}
else
break;
}
//удаление пробелов в конце
rTrim = lTrim;
for(counter = 1; counter <= strLen(lTrim) ; counter++)
{
if(confind(_trimStr, strdel(rTrim, 2, strlen(rTrim))))
{
rTrim = strdel(rTrim, 1, 1);
}
else
break;
}
return rTrim;
}