string.hpp File Reference
#include <string>
#include <sstream>
#include <vector>
Include dependency graph for string.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


template<class T >
std::string litesql::toString (T a)
 returns string representation of passed parameter if it can be written to ostringstream
bool litesql::startsWith (const std::string &what, const std::string &with)
 returns true if 'what' starts with 'with'
bool litesql::endsWith (const std::string &what, const std::string &with)
 returns true if 'what' end with 'with'
std::string litesql::toLower (const std::string &s)
 returns lower-case version of the string
std::string litesql::toUpper (const std::string &s)
 returns upper-case version of the string
std::string litesql::capitalize (const std::string &s)
std::string litesql::decapitalize (const std::string &s)
std::string litesql::rstrip (std::string s)
 returns a string with no empty characters at the end of the string
std::string litesql::lstrip (std::string s)
 returns a string with no empty characters at the beginning of the string
std::string litesql::replace (const std::string &s, const std::string &what, const std::string &with)
 returns a copy string 's' where 'what' is replaced with 'with'
int litesql::hexToInt (const std::string &s)
 converts string representation of a hex number to integer
int litesql::atoi (const std::string &s)
 string version of atoi
std::string litesql::operator* (int amount, const std::string &s)
 returns a string which is duplicated 'amount' times
std::string litesql::operator* (const std::string &s, int amount)
 returns a string which is duplicated 'amount' times
std::string litesql::escapeSQL (const std::string &str)
 escapes ' characters so that they do not break SQL statements. More...
std::vector< std::string > litesql::split (const std::string &s, const std::string &delim=" ")
 from string. More...
std::string litesql::join (const std::vector< std::string > &strings, const std::string &delim=" ")
 returns strings joined with delimiter
std::vector< std::string > litesql::slice (const std::vector< std::string > &strings, int start, int end)
 returns a part of strings More...

Detailed Description

helpful string utils

Function Documentation

◆ escapeSQL()

std::string litesql::escapeSQL ( const std::string &  str)

escapes ' characters so that they do not break SQL statements.

Note: 'NULL' is escaped to NULL

References litesql::escapeSQL().

Referenced by litesql::escapeSQL(), litesql::Backend::groupInsert(), and litesql::Database::insert().

◆ slice()

std::vector< std::string > litesql::slice ( const std::vector< std::string > &  strings,
int  start,
int  end 

returns a part of strings

startstarting index
endending index Indexes can be negative; actual index is calculated from the end of Split then.

References litesql::slice().

Referenced by litesql::join(), and litesql::slice().

◆ split()

std::vector<std::string> litesql::split ( const std::string &  s,
const std::string &  delim = " " 

from string.

Split to parts using delimeter

References litesql::split().

Referenced by litesql::split(). Logo