1#ifndef ROSE_StringUtility_Convert_H
2#define ROSE_StringUtility_Convert_H
11namespace StringUtility {
37ROSE_UTIL_API std::string
prefixLines(
const std::string &lines,
const std::string &prefix,
38 bool prefixAtFront=
true,
bool prefixAtBack=
false);
44ROSE_UTIL_API std::string
leftJustify(
const std::string &input,
size_t width,
char fill =
' ');
50ROSE_UTIL_API std::string
rightJustify(
const std::string &input,
size_t width,
char fill =
' ');
56ROSE_UTIL_API std::string
centerJustify(
const std::string &input,
size_t width,
char fill =
' ');
67ROSE_UTIL_API std::string
makeOneLine(
const std::string &s, std::string replacement=
" ");
72ROSE_UTIL_API std::string
trim(
const std::string &str,
const std::string &strip=
" \t\r\n",
73 bool at_beginning=
true,
bool at_end=
true);
76ROSE_UTIL_API std::string
untab(
const std::string &str,
size_t tabstops=8,
size_t firstcol=0);
101ROSE_UTIL_API std::string
encode_base64(
const std::vector<uint8_t> &data,
bool do_pad=
true);
102ROSE_UTIL_API std::string
encode_base64(
const uint8_t *data,
size_t nbytes,
bool do_padd=
true);
106ROSE_UTIL_API std::vector<uint8_t>
decode_base64(
const std::string &encoded);
ROSE_UTIL_API unsigned long generate_checksum(std::string s)
Compute a checkshum.
ROSE_UTIL_API std::string convertToLowerCase(const std::string &inputString)
Convert to lower case.
ROSE_UTIL_API std::string leftJustify(const std::string &input, size_t width, char fill=' ')
Left justify a string to specified width.
ROSE_UTIL_API std::string removeRedundantSubstrings(const std::string &)
Remove redundant and blank lines.
ROSE_UTIL_API std::vector< uint8_t > decode_base64(const std::string &encoded)
Convert base-64 to binary.
ROSE_UTIL_API std::string rightJustify(const std::string &input, size_t width, char fill=' ')
Right justify a string to specified width.
ROSE_UTIL_API std::string removeAnsiEscapes(const std::string &)
Remove ANSI escape characters.
ROSE_UTIL_API std::string makeOneLine(const std::string &s, std::string replacement=" ")
Converts a multi-line string to a single line.
ROSE_UTIL_API std::string encode_base64(const std::vector< uint8_t > &data, bool do_pad=true)
Convert binary data to base-64.
ROSE_UTIL_API std::string fixLineTermination(const std::string &input)
Normalizes line termination.
ROSE_UTIL_API std::string trim(const std::string &str, const std::string &strip=" \t\r\n", bool at_beginning=true, bool at_end=true)
Trims white space from the beginning and end of a string.
ROSE_UTIL_API std::string prefixLines(const std::string &lines, const std::string &prefix, bool prefixAtFront=true, bool prefixAtBack=false)
Insert a prefix string before every line.
ROSE_UTIL_API std::string centerJustify(const std::string &input, size_t width, char fill=' ')
Center a string in a field.
ROSE_UTIL_API std::string untab(const std::string &str, size_t tabstops=8, size_t firstcol=0)
Expand horizontal tab characters.