You are not logged in.
Pages: 1
Topic closed
Whats the quickes way to strip all whitespace from the beginning and the end of the string? Here's an example
Before: " This is a test string "
After: "This is a test string"
Trim for both beginin & end
there is also ltrim and rtrim for right & lefts :)
lol nice, can't believe I've never heard of the trim function
Hey, I would use the function Mir had pointed U at" U better" , but if U feel like programing in .cpp, here u go the code in .cpp:
//Delete all whitespace, excluding spaces following 1st significant
//character
i=0;
j=0;
while (line[i]!=CNULL && i<MAX_LINE_LENGTH)
{
if ( !isspace(line[i]) || (line[i]==' '&& j>0))
{
line[j] = line[i];
j++;
}
i++;
}
line[j] = CNULL;
}
that ismy two cents :)
Pages: 1
Topic closed