KrisLibrary  1.0.0
Functions
stringutils.h File Reference

Utilities for string manipulation. More...

#include <string>
#include <vector>

Go to the source code of this file.

Functions

char CloseBracket (char c)
 Returns a "close bracket" character opposite c.
 
void Lowercase (char *str)
 Turns the string into lower/uppercase.
 
void Uppercase (char *str)
 
void Lowercase (std::string &str)
 
void Uppercase (std::string &str)
 
std::string Strip (const std::string &str)
 
std::string LStrip (const std::string &str)
 
std::string RStrip (const std::string &str)
 
std::vector< std::string > Split (const std::string &str, const std::string &delim)
 
int ReplaceAll (std::string &str, const char *strfind, const char *strreplace)
 Replace all instances of strfind with strreplace in str.
 
bool StartsWith (const char *str, const char *prefix)
 Returns true if the beginning of the given string matches prefix.
 
bool EndsWith (const char *str, const char *suffix)
 Returns true if the end of the given string matches prefix.
 
bool IsValidCToken (const char *str)
 
bool IsValidInteger (const char *str)
 
bool IsValidFloat (const char *str)
 
int DetectNumericalPattern (const char *str, char prefix[], char suffix[], int &numDigits)
 
void IncrementStringDigits (char *str)
 
void IncrementStringDigits (std::string &str)
 
void ToBase64 (const std::string &in, std::string &out)
 
void ToBase64 (const char *in, int length, std::string &out)
 
void FromBase64 (const std::string &in, std::string &out)
 
void FromBase64 (const char *in, std::string &out)
 
std::string ToBase64 (const std::string &in)
 
std::string ToBase64 (const char *in, int length)
 
std::string FromBase64 (const std::string &in)
 
std::string FromBase64 (const char *in)
 
int LengthWithDOSEndlines (const char *str)
 Dos-unix endline conversion.
 
bool EndlinesToDOS (const char *str, char *out, int max)
 
bool EndlinesFromDOS (const char *str, char *out, int max)
 
void EndlinesToDOS (std::string &str)
 
void EndlinesFromDOS (std::string &str)
 
const char * FileExtension (const char *str)
 Returns pointer to "ext" for str="filename.ext".
 
void ChangeFileExtension (char *str, const char *ext)
 Replaces the file extension of str with ext, or concatenates .ext onto str.
 
const char * GetFileName (const char *str)
 Returns "file.ext" for the str="dir1/dir2/.../file.ext".
 
void GetFilePath (const char *str, char *buf)
 Extracts the path from str (formatted as above) into buf, not including the trailing '/'.
 
void StripExtension (char *str)
 Removes the file extension of str.
 
std::string FileExtension (const std::string &str)
 Returns "ext" for str="filename.ext".
 
void ChangeFileExtension (std::string &str, const char *ext)
 Replaces the file extension of str with ext, or concatenates .ext onto str.
 
std::string GetFileName (const std::string &str)
 Returns "file.ext" for the str="dir1/dir2/.../file.ext".
 
std::string GetFilePath (const std::string &str)
 Extracts the path from str (formatted as above), not including the trailing '/'.
 
void StripExtension (std::string &str)
 Removes the file extension of str.
 
void SplitPath (const std::string &path, std::vector< std::string > &elements)
 
std::string ReducePath (const std::string &path)
 
std::string JoinPath (const std::vector< std::string > &path, char delim=0)
 
std::string JoinPath (const std::string &path1, const std::string &path2)
 

Detailed Description

Utilities for string manipulation.