While I'm learning c++, I'm finding myself having to write lots of functions that are common to other "easier" languages. This would be stuff like trim and replace.
Does anyone have a common header file of all such common functions?
While I'm learning c++, I'm finding myself having to write lots of functions that are common to other "easier" languages. This would be stuff like trim and replace.
Does anyone have a common header file of all such common functions?
just found out that replace is part of the string class. i'll have to look over that class some more.
If you are working with strings or character arrays, then the STL can provide you with function that will help with such tasks as trim and replace. For example, the STL has functions such as replace, replace_if, replace_copy, replace_copy_if which can be called on character arrays. The string container has member functions such as replace and substr that can perform the job of replacing and trimming character strings.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens