MeshLib C Docs
Loading...
Searching...
No Matches
MRString.h File Reference
#include <MRCMisc/common.h>
#include <MRCMisc/exports.h>
#include <stdbool.h>

Go to the source code of this file.

Typedefs

typedef struct MR_std_string MR_std_string
 
typedef struct MR_std_string_view MR_std_string_view
 
typedef struct MR_std_vector_std_string MR_std_vector_std_string
 

Functions

MRC_API MR_uint64_t MR_findSubstringCaseInsensitive (const char *string, const char *string_end, const char *substring, const char *substring_end)
 
MRC_API int MR_calcDamerauLevenshteinDistance (const char *stringA, const char *stringA_end, const char *stringB, const char *stringB_end, const bool *caseSensitive, int *outLeftRightAddition)
 
MRC_API MR_std_vector_std_stringMR_split (const char *string, const char *string_end, const char *delimiter, const char *delimiter_end)
 
MRC_API MR_std_stringMR_replace (const char *target, const char *target_end, const char *from, const char *from_end, const char *to, const char *to_end)
 
MRC_API void MR_replaceInplace (MR_std_string *target, const char *from, const char *from_end, const char *to, const char *to_end)
 
MRC_API MR_std_string_viewMR_trim (const char *str, const char *str_end)
 
MRC_API MR_std_string_viewMR_trimLeft (const char *str, const char *str_end)
 
MRC_API MR_std_string_viewMR_trimRight (const char *str, const char *str_end)
 
MRC_API bool MR_hasFormatPlaceholders (const char *str, const char *str_end)
 

Typedef Documentation

◆ MR_std_string

typedef struct MR_std_string MR_std_string

◆ MR_std_string_view

◆ MR_std_vector_std_string

Function Documentation

◆ MR_calcDamerauLevenshteinDistance()

MRC_API int MR_calcDamerauLevenshteinDistance ( const char * stringA,
const char * stringA_end,
const char * stringB,
const char * stringB_end,
const bool * caseSensitive,
int * outLeftRightAddition )

Calculates Damerau-Levenshtein distance between to strings

Parameters
outLeftRightAdditionif provided return amount of insertions to the left and to the right Generated from function MR::calcDamerauLevenshteinDistance. Parameter stringA can not be null. If stringA_end is null, then stringA is assumed to be null-terminated. Parameter stringB can not be null. If stringB_end is null, then stringB is assumed to be null-terminated. Parameter caseSensitive has a default argument: true, pass a null pointer to use it. Parameter outLeftRightAddition defaults to a null pointer in C++.

◆ MR_findSubstringCaseInsensitive()

MRC_API MR_uint64_t MR_findSubstringCaseInsensitive ( const char * string,
const char * string_end,
const char * substring,
const char * substring_end )

Finds the substring in the string.

Returns
position, npos if not found Generated from function MR::findSubstringCaseInsensitive. Parameter string can not be null. If string_end is null, then string is assumed to be null-terminated. Parameter substring can not be null. If substring_end is null, then substring is assumed to be null-terminated.

◆ MR_hasFormatPlaceholders()

MRC_API bool MR_hasFormatPlaceholders ( const char * str,
const char * str_end )

Returns true if str has at least one {...} formatting placeholder. Generated from function MR::hasFormatPlaceholders. Parameter str can not be null. If str_end is null, then str is assumed to be null-terminated.

◆ MR_replace()

MRC_API MR_std_string * MR_replace ( const char * target,
const char * target_end,
const char * from,
const char * from_end,
const char * to,
const char * to_end )

Returns

Parameters
targetwith all
fromreplaced with
to,zeroor more times. Generated from function MR::replace. Parameter target can not be null. If target_end is null, then target is assumed to be null-terminated. Parameter from can not be null. If from_end is null, then from is assumed to be null-terminated. Parameter to can not be null. If to_end is null, then to is assumed to be null-terminated. Never returns null. Returns an instance allocated on the heap! Must call MR_std_string_Destroy() to free it when you're done using it.

◆ MR_replaceInplace()

MRC_API void MR_replaceInplace ( MR_std_string * target,
const char * from,
const char * from_end,
const char * to,
const char * to_end )

Replaces

Parameters
fromwith
toin
target(in-place), zero or more times. Generated from function MR::replaceInplace. Parameter target can not be null. It is a single object. Parameter from can not be null. If from_end is null, then from is assumed to be null-terminated. Parameter to can not be null. If to_end is null, then to is assumed to be null-terminated.

◆ MR_split()

MRC_API MR_std_vector_std_string * MR_split ( const char * string,
const char * string_end,
const char * delimiter,
const char * delimiter_end )

Splits given string by delimiter.

Returns
vector of split strings Generated from function MR::split. Parameter string can not be null. If string_end is null, then string is assumed to be null-terminated. Parameter delimiter can not be null. If delimiter_end is null, then delimiter is assumed to be null-terminated. Never returns null. Returns an instance allocated on the heap! Must call MR_std_vector_std_string_Destroy() to free it when you're done using it.

◆ MR_trim()

MRC_API MR_std_string_view * MR_trim ( const char * str,
const char * str_end )

Removes all whitespace character (detected by std::isspace) at the beginning and the end of string view Generated from function MR::trim. Parameter str can not be null. If str_end is null, then str is assumed to be null-terminated. Never returns null. Returns an instance allocated on the heap! Must call MR_std_string_view_Destroy() to free it when you're done using it.

◆ MR_trimLeft()

MRC_API MR_std_string_view * MR_trimLeft ( const char * str,
const char * str_end )

Removes all whitespace character (detected by std::isspace) at the beginning of string view Generated from function MR::trimLeft. Parameter str can not be null. If str_end is null, then str is assumed to be null-terminated. Never returns null. Returns an instance allocated on the heap! Must call MR_std_string_view_Destroy() to free it when you're done using it.

◆ MR_trimRight()

MRC_API MR_std_string_view * MR_trimRight ( const char * str,
const char * str_end )

Removes all whitespace character (detected by std::isspace) at the end of string view Generated from function MR::trimRight. Parameter str can not be null. If str_end is null, then str is assumed to be null-terminated. Never returns null. Returns an instance allocated on the heap! Must call MR_std_string_view_Destroy() to free it when you're done using it.