|
Elegant space trimming...
in vb there was a command known as Trim() that was used to remove the leading\training whitespace from strings. I recreated this in C++ when learning but never found a better way of doing it. Any suggestions?
Thanks
Chris
Chris Brodie
It depends on how inportant keeping isspace's definition of whitespace is to you. I sometimes do this.
Not really that different, except we pass most of the work to member functions and our definition of whitespace is a string
of examples. If we want to use a function to decide what is whitespace, and get all generic we could also do
operator * applied to a reverse_itterator returns a reference to the basic type, in this case a char, I then take this chars address and add one before passing it to erase.
Edited by - Grib on April 4, 2001 11:21:50 AM
|
Not really that different, except we pass most of the work to member functions and our definition of whitespace is a string
of examples. If we want to use a function to decide what is whitespace, and get all generic we could also do
|
operator * applied to a reverse_itterator returns a reference to the basic type, in this case a char, I then take this chars address and add one before passing it to erase.
Edited by - Grib on April 4, 2001 11:21:50 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement