c:string:trim
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | c:string:trim [2023/07/04 19:36] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Trim a std::string ====== | ||
+ | |||
+ | <code cpp> | ||
+ | std:: | ||
+ | { | ||
+ | str.erase(0, | ||
+ | return str; | ||
+ | } | ||
+ | |||
+ | std:: | ||
+ | { | ||
+ | str.erase(str.find_last_not_of(chars) + 1); | ||
+ | return str; | ||
+ | } | ||
+ | |||
+ | std:: | ||
+ | { | ||
+ | return ltrim(rtrim(str, | ||
+ | } | ||
+ | </ | ||
c/string/trim.txt · Last modified: 2023/07/04 19:36 by 127.0.0.1