|
|
static string | GenerateRandomName (idx_t length=16) |
| |
| static uint8_t | GetHexValue (char c) |
| |
| static uint8_t | GetBinaryValue (char c) |
| |
| static bool | CharacterIsSpace (char c) |
| |
| static bool | CharacterIsNewline (char c) |
| |
| static bool | CharacterIsDigit (char c) |
| |
| static bool | CharacterIsHex (char c) |
| |
| static char | CharacterToUpper (char c) |
| |
| static char | CharacterToLower (char c) |
| |
| static bool | CharacterIsAlpha (char c) |
| |
| static bool | CharacterIsAlphaNumeric (char c) |
| |
| static bool | CharacterIsOperator (char c) |
| |
| template<class TO > |
| static vector< TO > | ConvertStrings (const vector< string > &strings) |
| |
| static vector< SQLIdentifier > | ConvertToSQLIdentifiers (const vector< string > &strings) |
| |
| static vector< SQLString > | ConvertToSQLStrings (const vector< string > &strings) |
| |
|
static DUCKDB_API bool | Contains (const string &haystack, const string &needle) |
| | Returns true if the needle string exists in the haystack.
|
| |
|
static DUCKDB_API bool | Contains (const string &haystack, const char &needle_char) |
| |
|
static DUCKDB_API optional_idx | Find (const string &haystack, const string &needle) |
| | Returns the position of needle string within the haystack.
|
| |
|
static DUCKDB_API bool | StartsWith (string str, string prefix) |
| | Returns true if the target string starts with the given prefix.
|
| |
|
static DUCKDB_API bool | EndsWith (const string &str, const string &suffix) |
| | Returns true if the target string ends with the given suffix.
|
| |
|
static DUCKDB_API string | Repeat (const string &str, const idx_t n) |
| | Repeat a string multiple times.
|
| |
|
static DUCKDB_API vector< string > | Split (const string &str, char delimiter) |
| | Split the input string based on newline char.
|
| |
|
static DUCKDB_API vector< string > | SplitWithParentheses (const string &str, char delimiter=',', char par_open='(', char par_close=')') |
| | Split the input string, ignore delimiters within parentheses. Note: leading/trailing spaces are NOT stripped.
|
| |
|
static DUCKDB_API vector< string > | SplitWithQuote (const string &str, char delimiter=',', char quote='"') |
| | Split the input string allong a quote. Note that any escaping is NOT supported.
|
| |
|
static DUCKDB_API string | Join (const vector< string > &input, const string &separator) |
| | Join multiple strings into one string. Components are concatenated by the given separator.
|
| |
|
static DUCKDB_API string | Join (const set< string > &input, const string &separator) |
| |
|
static DUCKDB_API string | URLEncode (const string &str, bool encode_slash=true) |
| | Encode special URL characters in a string.
|
| |
|
static DUCKDB_API idx_t | URLEncodeSize (const char *input, idx_t input_size, bool encode_slash=true) |
| |
|
static DUCKDB_API void | URLEncodeBuffer (const char *input, idx_t input_size, char *output, bool encode_slash=true) |
| |
|
static DUCKDB_API string | URLDecode (const string &str, bool plus_to_space=false) |
| | Decode URL escape sequences (e.g. %20) in a string.
|
| |
|
static DUCKDB_API idx_t | URLDecodeSize (const char *input, idx_t input_size, bool plus_to_space=false) |
| |
|
static DUCKDB_API void | URLDecodeBuffer (const char *input, idx_t input_size, char *output, bool plus_to_space=false) |
| |
|
static DUCKDB_API void | SkipBOM (const char *buffer_ptr, const idx_t &buffer_size, idx_t &buffer_pos) |
| | BOM skipping (https://en.wikipedia.org/wiki/Byte_order_mark)
|
| |
|
static DUCKDB_API idx_t | ToUnsigned (const string &str) |
| |
|
static DUCKDB_API int64_t | ToSigned (const string &str) |
| |
|
static DUCKDB_API double | ToDouble (const string &str) |
| |
| template<class T > |
| static string | ToString (const vector< T > &input, const string &separator) |
| |
| template<typename C , typename S , typename FUNC > |
| static string | Join (const C &input, S count, const string &separator, FUNC f) |
| |
|
static DUCKDB_API string | BytesToHumanReadableString (idx_t bytes, idx_t multiplier=1024) |
| | Return a string that formats the give number of bytes.
|
| |
|
static DUCKDB_API string | TryParseFormattedBytes (const string &arg, idx_t &result) |
| |
|
static DUCKDB_API idx_t | ParseFormattedBytes (const string &arg) |
| |
|
static DUCKDB_API string | Upper (const string &str) |
| | Convert a string to UPPERCASE.
|
| |
|
static DUCKDB_API string | Lower (const string &str) |
| | Convert a string to lowercase.
|
| |
|
static DUCKDB_API string | Title (const string &str) |
| | Convert a string to Title Case.
|
| |
|
static DUCKDB_API bool | IsLower (const string &str) |
| |
|
static DUCKDB_API bool | IsUpper (const string &str) |
| |
|
static DUCKDB_API uint64_t | CIHash (const string &str) |
| | Case insensitive hash.
|
| |
|
static DUCKDB_API uint64_t | CIHash (const char *str, idx_t size) |
| |
|
static DUCKDB_API bool | CIEquals (const string &l1, const string &l2) |
| | Case insensitive equals.
|
| |
|
static DUCKDB_API bool | CIEquals (const char *l1, idx_t l1_size, const char *l2, idx_t l2_size) |
| | Case insensitive equals (null-terminated strings)
|
| |
|
static DUCKDB_API bool | CIStartsWith (const string &str, const string &prefix) |
| | Case insensitive starts-with.
|
| |
|
static DUCKDB_API bool | CILessThan (const string &l1, const string &l2) |
| | Case insensitive compare.
|
| |
|
static DUCKDB_API idx_t | CIFind (vector< string > &vec, const string &str) |
| | Case insensitive find, returns DConstants::INVALID_INDEX if not found.
|
| |
| template<typename... ARGS> |
| static string | Format (const string fmt_str, ARGS... params) |
| | Format a string using printf semantics.
|
| |
|
static DUCKDB_API vector< string > | Split (const string &input, const string &split) |
| | Split the input string into a vector of strings based on the split string.
|
| |
|
static DUCKDB_API void | LTrim (string &str) |
| | Remove the whitespace char in the left end of the string.
|
| |
|
static DUCKDB_API void | RTrim (string &str) |
| | Remove the whitespace char in the right end of the string.
|
| |
|
static DUCKDB_API void | RTrim (string &str, const string &chars_to_trim) |
| | Remove the all chars from chars_to_trim char in the right end of the string.
|
| |
|
static DUCKDB_API void | Trim (string &str) |
| | Remove the whitespace char in the left and right end of the string.
|
| |
|
static DUCKDB_API string | Replace (string source, const string &from, const string &to) |
| |
| static DUCKDB_API idx_t | LevenshteinDistance (const string &s1, const string &s2, idx_t not_equal_penalty=1) |
| |
|
static DUCKDB_API idx_t | SimilarityScore (const string &s1, const string &s2) |
| | Returns the similarity score between two strings (edit distance metric - lower is more similar)
|
| |
|
static DUCKDB_API double | SimilarityRating (const string &s1, const string &s2) |
| | Returns a normalized similarity rating between 0.0 - 1.0 (higher is more similar)
|
| |
| static DUCKDB_API vector< string > | TopNStrings (vector< pair< string, double > > scores, idx_t n=5, double threshold=0.5) |
| |
| static DUCKDB_API vector< string > | TopNStrings (const vector< pair< string, idx_t > > &scores, idx_t n=5, idx_t threshold=5) |
| |
| static DUCKDB_API vector< string > | TopNLevenshtein (const vector< string > &strings, const string &target, idx_t n=5, idx_t threshold=5) |
| |
| static DUCKDB_API vector< string > | TopNJaroWinkler (const vector< string > &strings, const string &target, idx_t n=5, double threshold=0.5) |
| |
|
static DUCKDB_API string | CandidatesMessage (const vector< string > &candidates, const string &candidate="Candidate bindings") |
| |
| static DUCKDB_API string | CandidatesErrorMessage (const vector< string > &strings, const string &target, const string &message_prefix, idx_t n=5) |
| |
| static bool | Equals (const char *s1, const char *s2) |
| |
| static bool | Equals (const string &s1, const char *s2) |
| |
| static bool | Equals (const char *s1, const string &s2) |
| |
| static bool | Equals (const string &s1, const string &s2) |
| |
|
static bool | Equals (const string_t &s1, const char *s2) |
| |
|
static bool | Equals (const char *s1, const string_t &s2) |
| |
| static DUCKDB_API unique_ptr< ComplexJSON > | ParseJSONMap (const string &json, bool ignore_errors=false) |
| |
| static DUCKDB_API string | ExceptionToJSONMap (ExceptionType type, const string &message, const unordered_map< string, string > &map) |
| |
|
static DUCKDB_API string | ToJSONMap (const unordered_map< string, string > &map) |
| | Transforms an unordered map to a JSON string.
|
| |
|
static DUCKDB_API string | ToComplexJSONMap (const ComplexJSON &complex_json) |
| | Transforms an complex JSON to a JSON string.
|
| |
|
static DUCKDB_API string | ValidateJSON (const char *data, const idx_t &len) |
| |
|
static DUCKDB_API string | GetFileName (const string &file_path) |
| |
|
static DUCKDB_API string | GetFileExtension (const string &file_name) |
| |
|
static DUCKDB_API string | GetFileStem (const string &file_name) |
| |
|
static DUCKDB_API string | GetFilePath (const string &file_path) |
| |
|
static DUCKDB_API uint32_t | StringToEnum (const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, const char *str_value) |
| |
|
static DUCKDB_API const char * | EnumToString (const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, uint32_t enum_value) |
| |
String Utility Functions Note that these are not the most efficient implementations (i.e., they copy memory) and therefore they should only be used for debug messages and other such things.