trim heading and trailing space

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone,


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.


thanks in advance,
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
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
 
Thanks Dave,


I think there is no built-in trim functions in even STL string. Right?


regards,
George
 
Hi Dave,


It is implemented by find_first_not_of and find_last_not_of of STL string,
no built-in functions.


regards,
George
 
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
 
Back
Top