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!=CNULL && i<MAX_LINE_LENGTH)
{
if ( !isspace(line) || (line==' '&& j>0))
{
line[j] = line;
j++;
}
i++;
}
line[j] = CNULL;

}

that ismy two cents :)
in PHP, you can use some useful built-in functions:

trim (left and right)
ltrim (left only)
rtrim (right only)

check the URIs for usage information :)

And here's the regex pattern to do it:
/^\s+|\s+$/g,""
enjoy!