-
-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1159 from Anakael/pr/anakael/sway-language-impr
[sway/language] Improve sway/language
- Loading branch information
Showing
6 changed files
with
197 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <string> | ||
|
||
const std::string WHITESPACE = " \n\r\t\f\v"; | ||
|
||
std::string ltrim(const std::string s) { | ||
size_t begin = s.find_first_not_of(WHITESPACE); | ||
return (begin == std::string::npos) ? "" : s.substr(begin); | ||
} | ||
|
||
std::string rtrim(const std::string s) { | ||
size_t end = s.find_last_not_of(WHITESPACE); | ||
return (end == std::string::npos) ? "" : s.substr(0, end + 1); | ||
} | ||
|
||
std::string trim(const std::string& s) { return rtrim(ltrim(s)); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters