AWS SDK for C++  1.9.66
AWS SDK for C++
Public Types | Static Public Member Functions | List of all members
Aws::Utils::StringUtils Class Reference

#include <StringUtils.h>

Public Types

enum  SplitOptions { SplitOptions::NOT_SET, SplitOptions::INCLUDE_EMPTY_ENTRIES }
 

Static Public Member Functions

static void Replace (Aws::String &s, const char *search, const char *replace)
 
static Aws::String ToLower (const char *source)
 
static Aws::String ToUpper (const char *source)
 
static bool CaselessCompare (const char *value1, const char *value2)
 
static Aws::String URLEncode (const char *unsafe)
 
static Aws::String UTF8Escape (const char *unicodeString, const char *delimiter)
 
static Aws::String URLEncode (double unsafe)
 
static Aws::String URLDecode (const char *safe)
 
static Aws::Vector< Aws::StringSplit (const Aws::String &toSplit, char splitOn)
 Splits a string on a delimiter (empty items are excluded). More...
 
static Aws::Vector< Aws::StringSplit (const Aws::String &toSplit, char splitOn, SplitOptions option)
 Splits a string on a delimiter. More...
 
static Aws::Vector< Aws::StringSplit (const Aws::String &toSplit, char splitOn, size_t numOfTargetParts)
 Splits a string on a delimiter (empty items are excluded). More...
 
static Aws::Vector< Aws::StringSplit (const Aws::String &toSplit, char splitOn, size_t numOfTargetParts, SplitOptions option)
 Splits a string on a delimiter. More...
 
static Aws::Vector< Aws::StringSplitOnLine (const Aws::String &toSplit)
 
static Aws::String LTrim (const char *source)
 
static Aws::String RTrim (const char *source)
 
static Aws::String Trim (const char *source)
 
static long long ConvertToInt64 (const char *source)
 
static long ConvertToInt32 (const char *source)
 
static bool ConvertToBool (const char *source)
 
static double ConvertToDouble (const char *source)
 
template<typename T >
static Aws::String to_string (T value)
 
static bool IsAlnum (char c)
 
template<typename T , class = typename std::enable_if<std::is_unsigned<T>::value>::type>
static Aws::String ToHexString (T value)
 
static Aws::String FromByteCursor (aws_byte_cursor cursor)
 

Detailed Description

All the things the c++ stdlib is missing for string operations that I needed.

Definition at line 23 of file StringUtils.h.

Member Enumeration Documentation

◆ SplitOptions

Enumerator
NOT_SET 

By default, removes all the empty entries in the vector returned by Split()

INCLUDE_EMPTY_ENTRIES 

Includes empty entries in the vector returned by Split()

Definition at line 70 of file StringUtils.h.

Member Function Documentation

◆ CaselessCompare()

static bool Aws::Utils::StringUtils::CaselessCompare ( const char *  value1,
const char *  value2 
)
static

Does a caseless comparison of two strings.

◆ ConvertToBool()

static bool Aws::Utils::StringUtils::ConvertToBool ( const char *  source)
static

convert to bool

◆ ConvertToDouble()

static double Aws::Utils::StringUtils::ConvertToDouble ( const char *  source)
static

convert to double

◆ ConvertToInt32()

static long Aws::Utils::StringUtils::ConvertToInt32 ( const char *  source)
static

convert to int 32

◆ ConvertToInt64()

static long long Aws::Utils::StringUtils::ConvertToInt64 ( const char *  source)
static

convert to int 64

◆ FromByteCursor()

static Aws::String Aws::Utils::StringUtils::FromByteCursor ( aws_byte_cursor  cursor)
inlinestatic

Definition at line 216 of file StringUtils.h.

◆ IsAlnum()

static bool Aws::Utils::StringUtils::IsAlnum ( char  c)
inlinestatic

locale agnostic implementation of std::isalnum

Definition at line 187 of file StringUtils.h.

◆ LTrim()

static Aws::String Aws::Utils::StringUtils::LTrim ( const char *  source)
static

static Aws::Vector<Aws::String> SplitOnRegex(Aws::String regex); trim from start

◆ Replace()

static void Aws::Utils::StringUtils::Replace ( Aws::String s,
const char *  search,
const char *  replace 
)
static

◆ RTrim()

static Aws::String Aws::Utils::StringUtils::RTrim ( const char *  source)
static

trim from end

◆ Split() [1/4]

static Aws::Vector<Aws::String> Aws::Utils::StringUtils::Split ( const Aws::String toSplit,
char  splitOn 
)
static

Splits a string on a delimiter (empty items are excluded).

Parameters
toSplit,theoriginal string to split
splitOn,thedelemiter you want to use.

◆ Split() [2/4]

static Aws::Vector<Aws::String> Aws::Utils::StringUtils::Split ( const Aws::String toSplit,
char  splitOn,
size_t  numOfTargetParts 
)
static

Splits a string on a delimiter (empty items are excluded).

Parameters
toSplit,theoriginal string to split
splitOn,thedelemiter you want to use.
numOfTargetParts,howmany target parts you want to get, if it is 0, as many as possible.

◆ Split() [3/4]

static Aws::Vector<Aws::String> Aws::Utils::StringUtils::Split ( const Aws::String toSplit,
char  splitOn,
size_t  numOfTargetParts,
SplitOptions  option 
)
static

Splits a string on a delimiter.

Parameters
toSplit,theoriginal string to split
splitOn,thedelemiter you want to use.
numOfTargetParts,howmany target parts you want to get, if it is 0, as many as possible.
option,ifINCLUDE_EMPTY_ENTRIES, includes empty entries in the result, otherwise removes empty entries.

◆ Split() [4/4]

static Aws::Vector<Aws::String> Aws::Utils::StringUtils::Split ( const Aws::String toSplit,
char  splitOn,
SplitOptions  option 
)
static

Splits a string on a delimiter.

Parameters
toSplit,theoriginal string to split
splitOn,thedelemiter you want to use.
option,ifINCLUDE_EMPTY_ENTRIES, includes empty entries in the result, otherwise removes empty entries.

◆ SplitOnLine()

static Aws::Vector<Aws::String> Aws::Utils::StringUtils::SplitOnLine ( const Aws::String toSplit)
static

Splits a string on new line characters.

◆ to_string()

template<typename T >
static Aws::String Aws::Utils::StringUtils::to_string ( value)
inlinestatic

not all platforms (Android) have std::to_string

Definition at line 177 of file StringUtils.h.

◆ ToHexString()

template<typename T , class = typename std::enable_if<std::is_unsigned<T>::value>::type>
static Aws::String Aws::Utils::StringUtils::ToHexString ( value)
inlinestatic

Convert an unsigned integer to its hex string in upper case.

Definition at line 196 of file StringUtils.h.

◆ ToLower()

static Aws::String Aws::Utils::StringUtils::ToLower ( const char *  source)
static

Converts a string to lower case.

◆ ToUpper()

static Aws::String Aws::Utils::StringUtils::ToUpper ( const char *  source)
static

Converts a string to upper case.

◆ Trim()

static Aws::String Aws::Utils::StringUtils::Trim ( const char *  source)
static

trim from both ends

◆ URLDecode()

static Aws::String Aws::Utils::StringUtils::URLDecode ( const char *  safe)
static

Decodes a URL encoded string (will handle both encoding schemes for spaces).

◆ URLEncode() [1/2]

static Aws::String Aws::Utils::StringUtils::URLEncode ( const char *  unsafe)
static

URL encodes a string (uses %20 not + for spaces).

◆ URLEncode() [2/2]

static Aws::String Aws::Utils::StringUtils::URLEncode ( double  unsafe)
static

URL encodes a double (if it ends up going to scientific notation) otherwise it just returns it as a string.

◆ UTF8Escape()

static Aws::String Aws::Utils::StringUtils::UTF8Escape ( const char *  unicodeString,
const char *  delimiter 
)
static

Http Clients tend to escape some characters but not all. Escaping all of them causes problems, because the client will also try to escape them. So this only escapes non-ascii characters and the + character


The documentation for this class was generated from the following file: