>I think in built-in C/C++ functions, there is no direct function call to
>trim heading and trailing space characters, right? So, we have to implement
>it manually by iterating the string to check character one by one.
>
>Support not using MFC.
George,
You're posing in a .Net group, so if you're using String ^, there is a
Trim method already.
If you're using native C++ using std:string, you might want to have a
look at the Boost library facilities which I believe have trim
facilities
(http://www.boost.org/doc/html/string_algo/usage.html#id1638126)
MFC's CString has its own Trim method built-in.
Dave
George - 21 Oct 2007 10:12 GMT
Thanks Dave,
I think there is no built-in trim functions in even STL string. Right?
regards,
George
> >I think in built-in C/C++ functions, there is no direct function call to
> >trim heading and trailing space characters, right? So, we have to implement
[quoted text clipped - 15 lines]
>
> Dave
David Lowndes - 21 Oct 2007 10:18 GMT
>I think there is no built-in trim functions in even STL string. Right?
None that I'm aware of - hence the Boost suggestion. There's an
article on CodeProject too -
http://www.codeproject.com/vcpp/stl/stdstringtrim.asp
Dave
George - 21 Oct 2007 10:30 GMT
Hi Dave,
It is implemented by find_first_not_of and find_last_not_of of STL string,
no built-in functions.
regards,
George
> >I think there is no built-in trim functions in even STL string. Right?
>
[quoted text clipped - 3 lines]
>
> Dave
David Lowndes - 21 Oct 2007 10:42 GMT
>It is implemented by find_first_not_of and find_last_not_of of STL string,
>no built-in functions.
Yes, that's what the CodeProject article uses.
Dave
George - 21 Oct 2007 14:19 GMT
Thanks Dave,
I think there is no built-in trim function and the method described in
CodeProject seems to be the best way.
regards,
George
> >It is implemented by find_first_not_of and find_last_not_of of STL string,
> >no built-in functions.
>
> Yes, that's what the CodeProject article uses.
>
> Dave