Spool is a lightweight and modular string manipulation library for C++. It seeks to replicate the greater string functionality provided by languages such as Java and Python. Stop wasting time rewriting the same old string functions for every new project.
- sp_contains
- sp_containsAfter
- sp_containsBefore
- sp_startsWith
- sp_startsWithIgnoreCase
- sp_endsWith
- sp_endsWithIgnoreCase
- sp_equalsIgnoreCase
- sp_isAlnum
- sp_isAlpha
- sp_isDigit
- sp_isLower
- sp_isUpper
- sp_isSpace
- sp_replace
- sp_replaceFirst
- sp_replaceLast
- sp_substringBeforeChar
- sp_substringAFterChar
- sp_toLowerCase
- sp_toUpperCase
- sp_capitalize
- sp_swapCase
- sp_trimWhitespace
- sp_trimWhitespaceLeft
- sp_trimWhitespaceRight
- sp_singleQuote
- sp_doubleQuote
- sp_repeat
bool sp_contains(const string& input, const string& phrase)
Returns true if the input string contains phrase
bool sp_containsAfter(const string& input, const string& phrase, size_t offset)
Returns true if the input string contains phrase at any point beyond offset
bool sp_containsBefore(const string& input, const string& phrase, size_t offset)
Returns true if the input string contains phrase at any point up until offset
bool sp_startsWith(const string& input, const string& phrase)
Returns true if the input string starts with phrase
bool sp_startsWith(const string& input, const string& phrase, size_t offset)
Returns true if the input string starts with phrase at offset
bool sp_startsWithIgnoreCase(string& input, string& phrase)
Returns true if the input string starts with phrase, ignores case
bool sp_startsWithIgnoreCase(const string& input, const string& phrase, size_t offset)
Returns true if the input string starts with phrase at offset, ignores case
bool sp_endsWith(const string& input, const string& phrase)
Returns true if the input string ends with phrase
bool sp_endsWith(const string& input, const string& phrase, size_t offset)
Returns true if the input string ends with phrase at offset from back
bool sp_endsWithIgnoreCase(const string& input, const string& phrase)
Returns true if the input string ends with phrase, ignores case
bool sp_endsWithIgnoreCase(string& input, string& phrase, size_t offset)
Returns true if the input string ends with phrase at offset from back, ignores case
bool sp_equalsIgnoreCase(const string& first, const string& second)
Returns true if the strings first and second are the same, ignores case
bool sp_isAlnum(const string& input)
Returns true if all characters in the string are alphanumeric and there is at least one character
bool sp_isAlpha(const string& input)
Returns true if all characters in the string are alphabetic and there is at least one character
bool sp_isDigit(const string& input)
Returns true if all characters in the string are digits and there is at least one character
bool sp_isLower(const string& input)
Returns true if all characters in the string are lowercase and there is at least one character
bool sp_isUpper(const string& input)
Returns true if all characters in the string are uppercase and there is at least one character
bool sp_isLower(const string& input)
Returns true if all characters in the string are whitespaces and there is at least one character
string sp_replace(string input, const string& target, const string& replacement)
Returns a copy of the input string with every instance of target replaced with replacement
string sp_replaceFirst(string input, const string& target, const string& replacement)
Returns a copy of the input string with the first instance of target replaced with replacement
string sp_replaceLast(string input, const string& target, const string& replacement)
Returns a copy of the input string with the last instance of target replaced with replacement
string sp_substringBeforeChar(std:string& input, const string& character);
Returns a substring of the input string starting at the beginning of input and going until the first instance of character
string sp_substringAfterChar(std:string& input, const string& character);
Returns a substring of the input string starting after the last instance of character and going until the end of input
string sp_toLowerCase(string input)
Returns a copy of the input string in lowercase
string sp_toUpperCase(string input)
Returns a copy of the input string in uppercase
string sp_capitalize(string input)
Returns a copy of the input string with the first character capitalized and the rest lowercased
string sp_swapCase(string input)
Returns a copy of the input string with uppercase characters converted to lowercase and vice versa
string sp_trimWhitespace(const string& input)
Returns a copy of the input string with leading and trailing whitespace trimmed
string sp_trimWhitespaceLeft(const string& input)
Returns a copy of the input string with leading whitespace trimmed
string sp_trimWhitespaceRight(const string& input)
Returns a copy of the input string with trailing whitespace trimmed
string sp_singleQuote(string input)
Returns a copy of the input string surrounded by single quotes
string sp_doubleQuote(string input)
Returns a copy of the input string surrounded by double quotes
string sp_repeat(string input, unsigned int count)
Returns a string consisting of the input string repeated count times