Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

trim heading and trailing space

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 21 Oct 2007 08:56 GMT
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
David Lowndes - 21 Oct 2007 09:57 GMT
>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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.