Class PString¶
Defined in File pstring.h
Class Documentation¶
-
class
puma::PString¶ Public Static Functions
-
static inline std::string
fromDouble(double d)¶ fromDouble: converts a double into a string
- Parameters
d – : double input
- Returns
: double represented as a float
-
static inline std::string
fromFloat(float f)¶ fromFloat: converts a float into a string
- Parameters
f – : float input
- Returns
: float represented as a float
-
static inline std::string
fromInt(int i)¶ fromInt: converts a int into a string
- Parameters
i – : int input
- Returns
: int represented as a float
-
static inline std::string
fromLong(long l)¶ fromLong: converts a long into a string
- Parameters
l – : long input
- Returns
: long represented as a float
-
static inline std::string
fromShort(short s)¶ fromShort: converts a short into a string
- Parameters
s – : short input
- Returns
: short represented as a float
-
static inline int
toInt(const std::string &s)¶ toInt: takes a string and attempts to parse the string into an int
- Parameters
s – : input string
- Returns
: returns the string parsed as an int or returns 0 if the parsing failed
-
static inline bool
toInt(const std::string &s, int &out)¶ toInt: takes a string and attempts to parse the string into an int
- Parameters
s – : input string
out – : the int is initialized to the parsed value if successful
- Returns
: true or false if parsing the string was successful.
-
static inline double
toDouble(const std::string &s)¶ toDouble: takes a string and attempts to parse the string into a double
- Parameters
s – : input string
- Returns
: returns the string parsed as a double or returns 0 if the parsing failed
-
static inline bool
toDouble(const std::string &s, double &out)¶ toDouble: takes a string and attempts to parse the string to a double
- Parameters
s – : input string
out – : the double is initialized to the parsed value if successful
- Returns
: true or false if parsing the string was successful.
-
static inline short
toShort(const std::string &s)¶ toShort: takes a string and attempts to parse the string into a short
- Parameters
s – : input string
- Returns
: returns the string parsed as a short or returns 0 if the parsing failed
-
static inline bool
toShort(const std::string &s, short &out)¶ toShort: takes a string and attempts to parse the string into a short
- Parameters
s – : input string
out – : the short is initialized to the parsed value if successful
- Returns
: true or false if parsing the string was successful.
-
static inline long
toLong(const std::string &s)¶ toLong: takes a string and attempts to parse the string into a long
- Parameters
s – : input string
- Returns
: returns the string parsed as a long or returns 0 if the parsing failed
-
static inline bool
toLong(const std::string &s, long &out)¶ toLong: takes a string and attempts to parse the string into a long
- Parameters
s – : input string
out – : the long is initialized to the parsed value if successful
- Returns
: true or false if parsing the string was successful.
-
static inline float
toFloat(const std::string &s)¶ toFloat: takes a string and attempts to parse the string into a float
- Parameters
s – : input string
- Returns
: returns the string parsed as a float or returns 0 if the parsing failed
-
static inline bool
toFloat(const std::string &s, float &out)¶ toFloat: takes a string and attempts to parse the string into a float
- Parameters
s – : input string
out – : the float is initialized to the parsed value if successful
- Returns
: true or false if parsing the string was successful.
-
static inline std::vector<std::string>
splitString(std::string str, const std::string &del)¶ splitString : takes an input string as splits the string into different pieces based on a delimiter
- Parameters
str – : input string to split
del – : delimiter used to identify where the string should be split
- Returns
a vector is returned with the differnt parts of the split string
-
static inline std::vector<std::string>
splitStringUnique(std::string str, const std::string &del)¶ splitStringUnique : takes an input string and splits the string into based on a deliminter and removes empty strings
- Parameters
str – : input string to split
del – : delimiter used to identify where to split the string
- Returns
a vector is returned with the split parts of the string. There will not be any empty strings
-
static inline std::string
trim(std::string str)¶ trim remove
and ” ” from both ends of the string
- Parameters
str – input string to trim
- Returns
a new string is returned with no whitespace on the ends of the string
-
static inline std::string
replaceFirst(std::string str, const std::string &oldString, std::string newString)¶ replaceFirst replace the first instance of string with a new string
- Parameters
str – : input string to adjust
oldString – : old string pattern to remove from input string
newString – : new pattern to replace the old pattern
- Returns
returns a new string with the first instance of oldString swapped. return the same string if the oldString does not exist
-
static inline std::string
replaceAll(std::string str, const std::string &oldString, const std::string &newString)¶ replaceAll replaces all instances of oldString and replaces them with newString
- Parameters
str – : input string to adjust
oldString – : old string pattern to remove
newString – : new string pattern to replace the old string pattern
- Returns
returns a new string with all instances of oldString replaced. returns the same string if the oldString does not exist
-
static inline bool
contains(const std::string &str, const std::string &token)¶ contains determines if the token exists in the input string
- Parameters
str – : input string to check
token – : token to look for in input string
- Returns
returns a boolean if the token exists in the string
-
static inline bool
starts_with(const std::string &str, const std::string &token)¶ starts_with determines if the string starts with the specified token
- Parameters
str – : input string to check
token – : token to look at the beginning of the string
- Returns
returns a boolean if the token exists at the beginning of the string
-
static inline bool
begins_with(const std::string &str, const std::string &token)¶
-
static inline bool
ends_with(const std::string &str, const std::string &token)¶ ends_with determines if the string ends with the specified token
- Parameters
str – : input string to check
token – : token to look for at the end of the string
- Returns
returns a boolean if the token exists at the end of the string
-
static inline bool
writeString(const std::string &output, const std::string &location)¶
-
static inline bool
writeStringAppend(const std::string &output, const std::string &location)¶
-
static inline std::string