Skip to content

Commit d33b31d

Browse files
committed
fix whitespace
1 parent 7e2df0c commit d33b31d

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

include/sta/StringUtil.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ isTmpString(const char *str);
199199
void
200200
trimRight(std::string &str);
201201

202+
// Trim left spaces.
203+
void
204+
trimLeft(std::string &str);
205+
206+
void
207+
trim(std::string &str);
208+
202209
typedef Vector<std::string> StringVector;
203210

204211
void

util/StringUtil.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,18 @@ trimRight(string &str)
258258
str.erase(str.find_last_not_of(" ") + 1);
259259
}
260260

261+
void
262+
trimLeft(string &str)
263+
{
264+
str.erase(0, str.find_last_not_of(" "));
265+
}
266+
267+
void
268+
trim(strin &str)
269+
{
270+
trimLeft(str);
271+
trimRight(str);
272+
}
261273
void
262274
split(const string &text,
263275
const string &delims,

0 commit comments

Comments
 (0)