Skip to content

nickcharles/Spool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spool

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.

Table of Contents

Documentation

sp_contains()

bool sp_contains(const string& input, const string& phrase)

Returns true if the input string contains phrase

sp_containsAfter()

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

sp_containsBefore()

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

sp_startsWith()

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

sp_startsWithIgnoreCase()

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

sp_endsWith()

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

sp_endsWithIgnoreCase()

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

sp_equalsIgnoreCase()

bool sp_equalsIgnoreCase(const string& first, const string& second)

Returns true if the strings first and second are the same, ignores case

sp_isAlnum()

bool sp_isAlnum(const string& input)

Returns true if all characters in the string are alphanumeric and there is at least one character

sp_isAlpha()

bool sp_isAlpha(const string& input)

Returns true if all characters in the string are alphabetic and there is at least one character

sp_isDigit()

bool sp_isDigit(const string& input)

Returns true if all characters in the string are digits and there is at least one character

sp_isLower()

bool sp_isLower(const string& input)

Returns true if all characters in the string are lowercase and there is at least one character

sp_isUpper()

bool sp_isUpper(const string& input)

Returns true if all characters in the string are uppercase and there is at least one character

sp_isSpace()

bool sp_isLower(const string& input)

Returns true if all characters in the string are whitespaces and there is at least one character

sp_replace()

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

sp_replaceFirst()

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

sp_replaceLast()

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

sp_substringBeforeChar()

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

sp_substringAfterChar()

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

sp_toLowerCase()

string sp_toLowerCase(string input)

Returns a copy of the input string in lowercase

sp_toUpperCase()

string sp_toUpperCase(string input)

Returns a copy of the input string in uppercase

sp_capitalize()

string sp_capitalize(string input)

Returns a copy of the input string with the first character capitalized and the rest lowercased

sp_swapCase()

string sp_swapCase(string input)

Returns a copy of the input string with uppercase characters converted to lowercase and vice versa

sp_trimWhitespace()

string sp_trimWhitespace(const string& input)

Returns a copy of the input string with leading and trailing whitespace trimmed

sp_trimWhitespaceLeft()

string sp_trimWhitespaceLeft(const string& input)

Returns a copy of the input string with leading whitespace trimmed

sp_trimWhitespaceRight()

string sp_trimWhitespaceRight(const string& input)

Returns a copy of the input string with trailing whitespace trimmed

sp_singleQuote()

string sp_singleQuote(string input)

Returns a copy of the input string surrounded by single quotes

sp_doubleQuote()

string sp_doubleQuote(string input)

Returns a copy of the input string surrounded by double quotes

sp_repeat()

string sp_repeat(string input, unsigned int count)

Returns a string consisting of the input string repeated count times

About

A string formatting and manipulation library for C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages