AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Functions
alexaClientSDK::avsCommon::utils::string Namespace Reference

Functions

bool stringToInt (const std::string &str, int *result)
 
bool stringToInt (const char *str, int *result)
 
bool stringToInt64 (const std::string &str, int64_t *result)
 
bool stringToInt64 (const char *str, int64_t *result)
 
std::string byteVectorToString (const std::vector< uint8_t > &byteVector)
 
std::string stringToLowerCase (const std::string &input)
 
std::string stringToUpperCase (const std::string &input)
 
std::string replaceAllSubstring (const std::string &str, const std::string &from, const std::string &to)
 
std::string ltrim (const std::string &str)
 

Function Documentation

◆ byteVectorToString()

std::string alexaClientSDK::avsCommon::utils::string::byteVectorToString ( const std::vector< uint8_t > &  byteVector)

A utility function to convert a vector of bytes to a printable string. For example, the vector {1, 2, 3} will return the string "0x01 0x02 0x03"

Parameters
byteVectora vector of bytes
Returns
a string of the hex values of each byte printed.

◆ ltrim()

std::string alexaClientSDK::avsCommon::utils::string::ltrim ( const std::string &  str)

Trim whitespace from the left.

Parameters
strthe string to trim from the left
Returns
the trimmed string

◆ replaceAllSubstring()

std::string alexaClientSDK::avsCommon::utils::string::replaceAllSubstring ( const std::string &  str,
const std::string &  from,
const std::string &  to 
)

Replaces all occurrences of a substring with another string.

Parameters
strThe reference string.
fromThe string to find.
toThe replacement string.
Returns
A new string with the replaced substrings.

◆ stringToInt() [1/2]

bool alexaClientSDK::avsCommon::utils::string::stringToInt ( const std::string &  str,
int *  result 
)

A utility function to convert a std::string to an integer. If the string is successfully parsed, then the out parameter will be updated.

Parameters
strThe string input.
[out]resultThe resulting integer, if successfully parsed from the string.
Returns
true If the string was parsed as an integer, otherwise false.

◆ stringToInt() [2/2]

bool alexaClientSDK::avsCommon::utils::string::stringToInt ( const char *  str,
int *  result 
)

A utility function to convert a c-string to an integer. If the string is successfully parsed, then the out parameter will be updated.

Parameters
strThe C-string input.
[out]resultThe resulting integer, if successfully parsed from the string.
Returns
true If the string was parsed as an integer, otherwise false.

◆ stringToInt64() [1/2]

bool alexaClientSDK::avsCommon::utils::string::stringToInt64 ( const std::string &  str,
int64_t *  result 
)

A utility function to convert a string to an integer 64 bits. If the string is successfully parsed, then the out parameter will be updated.

Parameters
strThe string input.
[out]resultThe resulting integer, if successfully parsed from the string.
Returns
true If the string was parsed as an integer, otherwise false.

◆ stringToInt64() [2/2]

bool alexaClientSDK::avsCommon::utils::string::stringToInt64 ( const char *  str,
int64_t *  result 
)

A utility function to convert a c-string to an integer 64 bits. If the string is successfully parsed, then the out parameter will be updated.

Parameters
strThe C-string input.
[out]resultThe resulting integer, if successfully parsed from the string.
Returns
true If the string was parsed as an integer, otherwise false.

◆ stringToLowerCase()

std::string alexaClientSDK::avsCommon::utils::string::stringToLowerCase ( const std::string &  input)

A utility function to convert a string into lower case.

Parameters
inputThe input string to be converted.
Returns
The converted string in lower case.

◆ stringToUpperCase()

std::string alexaClientSDK::avsCommon::utils::string::stringToUpperCase ( const std::string &  input)

A utility function to convert a string into upper case.

Parameters
inputThe input string to be converted.
Returns
The converted string in upper case.

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0