Loading...
Searching...
No Matches
string.h File Reference

Furi string container. More...

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
#include <m-core.h>

Go to the source code of this file.

Macros

#define FURI_STRING_FAILURE   ((size_t) - 1)
 Furi string failure constant.
 
#define FURI_STRING_SELECT1(func1, func2, a)
 Select either the string function or the str function depending on the b operand to the function.
 
#define FURI_STRING_SELECT2(func1, func2, a, b)
 Select for 2 arguments.
 
#define FURI_STRING_SELECT3(func1, func2, a, b, c)
 Select for 3 arguments.
 
#define FURI_STRING_SELECT4(func1, func2, a, b, c, d)
 Select for 4 arguments.
 
#define furi_string_alloc_set(a)
 Allocate new FuriString and set it content to string (or C string).
 
#define furi_string_set(a, b)
 Set the string content to string (or C string).
 
#define furi_string_cmp(a, b)
 Compare string with string (or C string) and return the sort order.
 
#define furi_string_cmpi(a, b)
 Compare string with string (or C string) (case insensitive according to the current locale) and return the sort order.
 
#define furi_string_equal(a, b)
 Test if the string is equal to the string (or C string).
 
#define furi_string_replace_all(a, b, c)
 Replace all occurrences of string into string (or C string to another C string) in a string.
 
#define furi_string_search(...)
 Search for a string (or C string) in a string.
 
#define furi_string_search_str(...)
 Search for a C string in a string.
 
#define furi_string_start_with(a, b)
 Test if the string starts with the given string (or C string).
 
#define furi_string_end_with(a, b)
 Test if the string ends with the given string (or C string).
 
#define furi_string_end_withi(a, b)
 Test if the string ends with the given string (or C string) (case insensitive according to the current locale).
 
#define furi_string_cat(a, b)
 Append a string (or C string) to the string.
 
#define furi_string_trim(...)
 Trim a string from the given set of characters (default is " \n\r\t").
 
#define furi_string_search_char(...)
 Search for a character in a string.
 
#define furi_string_search_rchar(...)
 Reverse Search for a character in a string.
 
#define furi_string_replace(...)
 Replace a string to another string (or C string to another C string) in a string.
 
#define furi_string_replace_str(...)
 Replace a C string to another C string in a string.
 
#define F_STR_INIT(a)
 INIT OPLIST for FuriString.
 
#define F_STR_INIT_SET(a, b)
 INIT SET OPLIST for FuriString.
 
#define F_STR_INIT_MOVE(a, b)
 INIT MOVE OPLIST for FuriString.
 
#define FURI_STRING_OPLIST
 OPLIST for FuriString.
 

Typedefs

typedef struct FuriString FuriString
 Furi string primitive.
 
typedef unsigned int FuriStringUnicodeValue
 An unicode value.
 

Enumerations

enum  FuriStringUTF8State {
  FuriStringUTF8StateStarting , FuriStringUTF8StateDecoding1 , FuriStringUTF8StateDecoding2 , FuriStringUTF8StateDecoding3 ,
  FuriStringUTF8StateError
}
 State of the UTF8 decoding machine state.
 

Functions

FuriStringfuri_string_alloc (void)
 Allocate new FuriString.
 
FuriStringfuri_string_alloc_set (const FuriString *source)
 Allocate new FuriString and set it to string.
 
FuriStringfuri_string_alloc_set_str (const char cstr_source[])
 Allocate new FuriString and set it to C string.
 
FuriStringfuri_string_alloc_printf (const char format[],...) _ATTRIBUTE((__format__(__printf__
 Allocate new FuriString and printf to it.
 
FuriString FuriStringfuri_string_alloc_vprintf (const char format[], va_list args)
 Allocate new FuriString and printf to it.
 
FuriStringfuri_string_alloc_move (FuriString *source)
 Allocate new FuriString and move source string content to it.
 
void furi_string_free (FuriString *string)
 Free FuriString.
 
void furi_string_reserve (FuriString *string, size_t size)
 Reserve memory for string.
 
void furi_string_reset (FuriString *string)
 Reset string.
 
void furi_string_swap (FuriString *string_1, FuriString *string_2)
 Swap two strings.
 
void furi_string_move (FuriString *string_1, FuriString *string_2)
 Move string_2 content to string_1.
 
size_t furi_string_hash (const FuriString *string)
 Compute a hash for the string.
 
size_t furi_string_size (const FuriString *string)
 Get string size (usually length, but not for UTF-8)
 
bool furi_string_empty (const FuriString *string)
 Check that string is empty or not.
 
char furi_string_get_char (const FuriString *string, size_t index)
 Get the character at the given index.
 
const char * furi_string_get_cstr (const FuriString *string)
 Return the string view a classic C string.
 
void furi_string_set (FuriString *string, FuriString *source)
 Set the string to the other string.
 
void furi_string_set_str (FuriString *string, const char source[])
 Set the string to the other C string.
 
void furi_string_set_strn (FuriString *string, const char source[], size_t length)
 Set the string to the n first characters of the C string.
 
void furi_string_set_char (FuriString *string, size_t index, const char c)
 Set the character at the given index.
 
void furi_string_set_n (FuriString *string, const FuriString *source, size_t offset, size_t length)
 Set the string to the n first characters of other one.
 
int furi_string_printf (FuriString *string, const char format[],...) _ATTRIBUTE((__format__(__printf__
 Format in the string the given printf format.
 
int int furi_string_vprintf (FuriString *string, const char format[], va_list args)
 Format in the string the given printf format.
 
void furi_string_push_back (FuriString *string, char c)
 Append a character to the string.
 
void furi_string_cat (FuriString *string_1, const FuriString *string_2)
 Append a string to the string.
 
void furi_string_cat_str (FuriString *string_1, const char cstring_2[])
 Append a C string to the string.
 
int furi_string_cat_printf (FuriString *string, const char format[],...) _ATTRIBUTE((__format__(__printf__
 Append to the string the formatted string of the given printf format.
 
int int furi_string_cat_vprintf (FuriString *string, const char format[], va_list args)
 Append to the string the formatted string of the given printf format.
 
int furi_string_cmp (const FuriString *string_1, const FuriString *string_2)
 Compare two strings and return the sort order.
 
int furi_string_cmp_str (const FuriString *string_1, const char cstring_2[])
 Compare string with C string and return the sort order.
 
int furi_string_cmpi (const FuriString *string_1, const FuriString *string_2)
 Compare two strings (case insensitive according to the current locale) and return the sort order.
 
int furi_string_cmpi_str (const FuriString *string_1, const char cstring_2[])
 Compare string with C string (case insensitive according to the current locale) and return the sort order.
 
size_t furi_string_search (const FuriString *string, const FuriString *needle, size_t start)
 Search the first occurrence of the needle in the string from the position start.
 
size_t furi_string_search_str (const FuriString *string, const char needle[], size_t start)
 Search the first occurrence of the needle in the string from the position start.
 
size_t furi_string_search_char (const FuriString *string, char c, size_t start)
 Search for the position of the character c from the position start (include) in the string.
 
size_t furi_string_search_rchar (const FuriString *string, char c, size_t start)
 Reverse search for the position of the character c from the position start (include) in the string.
 
bool furi_string_equal (const FuriString *string_1, const FuriString *string_2)
 Test if two strings are equal.
 
bool furi_string_equal_str (const FuriString *string_1, const char cstring_2[])
 Test if the string is equal to the C string.
 
void furi_string_replace_at (FuriString *string, size_t pos, size_t len, const char replace[])
 Replace in the string the sub-string at position 'pos' for 'len' bytes into the C string 'replace'.
 
size_t furi_string_replace (FuriString *string, FuriString *needle, FuriString *replace, size_t start)
 Replace a string 'needle' to string 'replace' in a string from 'start' position.
 
size_t furi_string_replace_str (FuriString *string, const char needle[], const char replace[], size_t start)
 Replace a C string 'needle' to C string 'replace' in a string from 'start' position.
 
void furi_string_replace_all (FuriString *string, const FuriString *needle, const FuriString *replace)
 Replace all occurrences of 'needle' string into 'replace' string.
 
void furi_string_replace_all_str (FuriString *string, const char needle[], const char replace[])
 Replace all occurrences of 'needle' C string into 'replace' C string.
 
bool furi_string_start_with (const FuriString *string, const FuriString *start)
 Test if the string starts with the given string.
 
bool furi_string_start_with_str (const FuriString *string, const char start[])
 Test if the string starts with the given C string.
 
bool furi_string_end_with (const FuriString *string, const FuriString *end)
 Test if the string ends with the given string.
 
bool furi_string_end_withi (const FuriString *string, const FuriString *end)
 Test if the string ends with the given string (case insensitive according to the current locale).
 
bool furi_string_end_with_str (const FuriString *string, const char end[])
 Test if the string ends with the given C string.
 
bool furi_string_end_withi_str (const FuriString *string, const char end[])
 Test if the string ends with the given C string (case insensitive according to the current locale).
 
void furi_string_left (FuriString *string, size_t index)
 Trim the string left to the first 'index' bytes.
 
void furi_string_right (FuriString *string, size_t index)
 Trim the string right from the 'index' position to the last position.
 
void furi_string_mid (FuriString *string, size_t index, size_t size)
 Trim the string from position index to size bytes.
 
void furi_string_trim (FuriString *string, const char chars[])
 Trim a string from the given set of characters (default is " \n\r\t").
 
size_t furi_string_utf8_length (FuriString *string)
 Compute the length in UTF8 characters in the string.
 
void furi_string_utf8_push (FuriString *string, FuriStringUnicodeValue unicode)
 Push unicode into string, encoding it in UTF8.
 
void furi_string_utf8_decode (char c, FuriStringUTF8State *state, FuriStringUnicodeValue *unicode)
 Main generic UTF8 decoder.
 

Detailed Description

Furi string container.

And various method to manipulate strings

Macro Definition Documentation

◆ F_STR_INIT

#define F_STR_INIT ( a)
Value:
FuriString * furi_string_alloc(void)
Allocate new FuriString.
Definition string.c:26

INIT OPLIST for FuriString.

◆ F_STR_INIT_MOVE

#define F_STR_INIT_MOVE ( a,
b )
Value:
FuriString * furi_string_alloc_move(FuriString *source)
Allocate new FuriString and move source string content to it.
Definition string.c:58

INIT MOVE OPLIST for FuriString.

◆ F_STR_INIT_SET

#define F_STR_INIT_SET ( a,
b )
Value:
#define furi_string_alloc_set(a)
Allocate new FuriString and set it content to string (or C string).
Definition string.h:654

INIT SET OPLIST for FuriString.

◆ furi_string_alloc_set

#define furi_string_alloc_set ( a)
Value:
FuriString * furi_string_alloc_set_str(const char cstr_source[])
Allocate new FuriString and set it to C string.
Definition string.c:38
#define FURI_STRING_SELECT1(func1, func2, a)
Select either the string function or the str function depending on the b operand to the function.
Definition string.h:631

Allocate new FuriString and set it content to string (or C string).

([c]string)

◆ furi_string_cat

#define furi_string_cat ( a,
b )
Value:
void furi_string_cat_str(FuriString *string_1, const char cstring_2[])
Append a C string to the string.
Definition string.c:272
#define furi_string_cat(a, b)
Append a string (or C string) to the string.
Definition string.h:731
#define FURI_STRING_SELECT2(func1, func2, a, b)
Select for 2 arguments.
Definition string.h:636

Append a string (or C string) to the string.

(string, [c]string)

◆ furi_string_cmp

#define furi_string_cmp ( a,
b )
Value:
#define furi_string_cmp(a, b)
Compare string with string (or C string) and return the sort order.
Definition string.h:668
int furi_string_cmp_str(const FuriString *string_1, const char cstring_2[])
Compare string with C string and return the sort order.
Definition string.c:121

Compare string with string (or C string) and return the sort order.

Note: doesn't work with UTF-8 strings. (string, [c]string)

◆ furi_string_cmpi

#define furi_string_cmpi ( a,
b )
Value:
int furi_string_cmpi_str(const FuriString *string_1, const char cstring_2[])
Compare string with C string (case insensitive according to the current locale) and return the sort o...
Definition string.c:129
#define furi_string_cmpi(a, b)
Compare string with string (or C string) (case insensitive according to the current locale) and retur...
Definition string.h:675

Compare string with string (or C string) (case insensitive according to the current locale) and return the sort order.

Note: doesn't work with UTF-8 strings. (string, [c]string)

◆ furi_string_end_with

#define furi_string_end_with ( a,
b )
Value:
bool furi_string_end_with_str(const FuriString *string, const char end[])
Test if the string ends with the given C string.
Definition string.c:226
#define furi_string_end_with(a, b)
Test if the string ends with the given string (or C string).
Definition string.h:717

Test if the string ends with the given string (or C string).

(string, [c]string)

◆ furi_string_end_withi

#define furi_string_end_withi ( a,
b )
Value:
bool furi_string_end_withi_str(const FuriString *string, const char end[])
Test if the string ends with the given C string (case insensitive according to the current locale).
Definition string.c:230
#define furi_string_end_withi(a, b)
Test if the string ends with the given string (or C string) (case insensitive according to the curren...
Definition string.h:724

Test if the string ends with the given string (or C string) (case insensitive according to the current locale).

(string, [c]string)

◆ furi_string_equal

#define furi_string_equal ( a,
b )
Value:
bool furi_string_equal_str(const FuriString *string_1, const char cstring_2[])
Test if the string is equal to the C string.
Definition string.c:145
#define furi_string_equal(a, b)
Test if the string is equal to the string (or C string).
Definition string.h:681

Test if the string is equal to the string (or C string).

(string, [c]string)

◆ FURI_STRING_OPLIST

#define FURI_STRING_OPLIST
Value:
(INIT(F_STR_INIT), \
INIT_SET(F_STR_INIT_SET), \
INIT_MOVE(F_STR_INIT_MOVE), \
EMPTY_P(furi_string_empty), \
CLEAR(furi_string_free), \
TYPE(FuriString*))
#define furi_string_set(a, b)
Set the string content to string (or C string).
Definition string.h:661
void furi_string_swap(FuriString *string_1, FuriString *string_2)
Swap two strings.
Definition string.c:79
void furi_string_free(FuriString *string)
Free FuriString.
Definition string.c:65
#define F_STR_INIT(a)
INIT OPLIST for FuriString.
Definition string.h:769
bool furi_string_empty(const FuriString *string)
Check that string is empty or not.
Definition string.c:185
void furi_string_move(FuriString *string_1, FuriString *string_2)
Move string_2 content to string_1.
Definition string.c:83
#define F_STR_INIT_SET(a, b)
INIT SET OPLIST for FuriString.
Definition string.h:772
void furi_string_reset(FuriString *string)
Reset string.
Definition string.c:74
#define F_STR_INIT_MOVE(a, b)
INIT MOVE OPLIST for FuriString.
Definition string.h:775
size_t furi_string_hash(const FuriString *string)
Compute a hash for the string.
Definition string.c:89
Definition string.c:4

OPLIST for FuriString.

◆ furi_string_replace

#define furi_string_replace ( ...)
Value:
M_APPLY( \
M_DEFAULT_ARGS(4, (0), __VA_ARGS__))
#define FURI_STRING_SELECT4(func1, func2, a, b, c, d)
Select for 4 arguments.
Definition string.h:646
#define furi_string_replace_str(...)
Replace a C string to another C string in a string.
Definition string.h:766
#define furi_string_replace(...)
Replace a string to another string (or C string to another C string) in a string.
Definition string.h:755

Replace a string to another string (or C string to another C string) in a string.

(string, [c]string, [c]string[, start=0])

◆ furi_string_replace_all

#define furi_string_replace_all ( a,
b,
c )
Value:
void furi_string_replace_all_str(FuriString *string, const char needle[], const char replace[])
Replace all occurrences of 'needle' C string into 'replace' C string.
Definition string.c:202
#define furi_string_replace_all(a, b, c)
Replace all occurrences of string into string (or C string to another C string) in a string.
Definition string.h:687
#define FURI_STRING_SELECT3(func1, func2, a, b, c)
Select for 3 arguments.
Definition string.h:641

Replace all occurrences of string into string (or C string to another C string) in a string.

(string, [c]string, [c]string)

◆ furi_string_replace_str

#define furi_string_replace_str ( ...)
Value:
furi_string_replace_str(M_DEFAULT_ARGS(4, (0), __VA_ARGS__))

Replace a C string to another C string in a string.

(string, cstring, cstring[, start=0])

◆ furi_string_search

#define furi_string_search ( ...)
Value:
M_APPLY( \
M_DEFAULT_ARGS(3, (0), __VA_ARGS__))
#define furi_string_search(...)
Search for a string (or C string) in a string.
Definition string.h:694
#define furi_string_search_str(...)
Search for a C string in a string.
Definition string.h:704

Search for a string (or C string) in a string.

(string, [c]string[, start=0])

◆ furi_string_search_char

#define furi_string_search_char ( ...)
Value:
furi_string_search_char(M_DEFAULT_ARGS(3, (0), __VA_ARGS__))
#define furi_string_search_char(...)
Search for a character in a string.
Definition string.h:743

Search for a character in a string.

(string, character[, start=0])

◆ furi_string_search_rchar

#define furi_string_search_rchar ( ...)
Value:
furi_string_search_rchar(M_DEFAULT_ARGS(3, (0), __VA_ARGS__))
#define furi_string_search_rchar(...)
Reverse Search for a character in a string.
Definition string.h:749

Reverse Search for a character in a string.

(string, character[, start=0])

◆ furi_string_search_str

#define furi_string_search_str ( ...)
Value:
furi_string_search_str(M_DEFAULT_ARGS(3, (0), __VA_ARGS__))

Search for a C string in a string.

(string, cstring[, start=0])

◆ FURI_STRING_SELECT1

#define FURI_STRING_SELECT1 ( func1,
func2,
a )
Value:
_Generic((a), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \
a)

Select either the string function or the str function depending on the b operand to the function.

func1 is the string function / func2 is the str function. Select for 1 argument

◆ FURI_STRING_SELECT2

#define FURI_STRING_SELECT2 ( func1,
func2,
a,
b )
Value:
_Generic((b), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \
a, b)

Select for 2 arguments.

◆ FURI_STRING_SELECT3

#define FURI_STRING_SELECT3 ( func1,
func2,
a,
b,
c )
Value:
_Generic((b), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \
a, b, c)

Select for 3 arguments.

◆ FURI_STRING_SELECT4

#define FURI_STRING_SELECT4 ( func1,
func2,
a,
b,
c,
d )
Value:
_Generic((b), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \
a, b, c, d)

Select for 4 arguments.

◆ furi_string_set

#define furi_string_set ( a,
b )
Value:
void furi_string_set_str(FuriString *string, const char source[])
Set the string to the other C string.
Definition string.c:105

Set the string content to string (or C string).

(string, [c]string)

◆ furi_string_start_with

#define furi_string_start_with ( a,
b )
Value:
#define furi_string_start_with(a, b)
Test if the string starts with the given string (or C string).
Definition string.h:710
bool furi_string_start_with_str(const FuriString *string, const char start[])
Test if the string starts with the given C string.
Definition string.c:214

Test if the string starts with the given string (or C string).

(string, [c]string)

◆ furi_string_trim

#define furi_string_trim ( ...)
Value:
furi_string_trim(M_DEFAULT_ARGS(2, (" \n\r\t"), __VA_ARGS__))
#define furi_string_trim(...)
Trim a string from the given set of characters (default is " \n\r\t").
Definition string.h:737

Trim a string from the given set of characters (default is " \n\r\t").

(string[, set=" \n\r\t"])

Function Documentation

◆ furi_string_alloc()

FuriString * furi_string_alloc ( void )

Allocate new FuriString.

Returns
pointer to the instance of FuriString

◆ furi_string_alloc_move()

FuriString * furi_string_alloc_move ( FuriString * source)

Allocate new FuriString and move source string content to it.

Allocate the string, set it to the other one, and destroy the other one.

Parameters
sourceThe source FuriString instance
Returns
pointer to the new instance of FuriString

◆ furi_string_alloc_printf()

FuriString * furi_string_alloc_printf ( const char format[],
... )

Allocate new FuriString and printf to it.

Initialize and set a string to the given formatted value.

Parameters
formatThe printf format
[in]...args to format
Returns
pointer to the new instance of FuriString

◆ furi_string_alloc_set()

FuriString * furi_string_alloc_set ( const FuriString * source)

Allocate new FuriString and set it to string.

Allocate & Set the string a to the string.

Parameters
sourceThe source FuriString instance
Returns
pointer to the new instance of FuriString

◆ furi_string_alloc_set_str()

FuriString * furi_string_alloc_set_str ( const char cstr_source[])

Allocate new FuriString and set it to C string.

Allocate & Set the string a to the C string.

Parameters
cstr_sourceThe C-string instance
Returns
pointer to the new instance of FuriString

◆ furi_string_alloc_vprintf()

FuriString FuriString * furi_string_alloc_vprintf ( const char format[],
va_list args )

Allocate new FuriString and printf to it.

Initialize and set a string to the given formatted value.

Parameters
formatThe printf format
argsThe format arguments
Returns
pointer to the new instance of FuriString

◆ furi_string_cat()

void furi_string_cat ( FuriString * string_1,
const FuriString * string_2 )

Append a string to the string.

Concatenate the string with the other string.

Parameters
string_1The string 1
string_2The string 2

◆ furi_string_cat_printf()

int furi_string_cat_printf ( FuriString * string,
const char format[],
... )

Append to the string the formatted string of the given printf format.

Parameters
stringThe string
formatThe format
[in]...The args
Returns
number of characters printed or negative value on error

◆ furi_string_cat_str()

void furi_string_cat_str ( FuriString * string_1,
const char cstring_2[] )

Append a C string to the string.

Concatenate the string with the C string.

Parameters
string_1The string 1
cstring_2The cstring 2

◆ furi_string_cat_vprintf()

int int furi_string_cat_vprintf ( FuriString * string,
const char format[],
va_list args )

Append to the string the formatted string of the given printf format.

Parameters
stringThe FuriString instance
formatThe format
argsThe arguments
Returns
number of characters printed or negative value on error

◆ furi_string_cmp()

int furi_string_cmp ( const FuriString * string_1,
const FuriString * string_2 )

Compare two strings and return the sort order.

Parameters
string_1The string 1
string_2The string 2
Returns
zero if equal

◆ furi_string_cmp_str()

int furi_string_cmp_str ( const FuriString * string_1,
const char cstring_2[] )

Compare string with C string and return the sort order.

Parameters
string_1The string 1
cstring_2The cstring 2
Returns
zero if equal

◆ furi_string_cmpi()

int furi_string_cmpi ( const FuriString * string_1,
const FuriString * string_2 )

Compare two strings (case insensitive according to the current locale) and return the sort order.

Note: doesn't work with UTF-8 strings.

Parameters
string_1The string 1
string_2The string 2
Returns
zero if equal

◆ furi_string_cmpi_str()

int furi_string_cmpi_str ( const FuriString * string_1,
const char cstring_2[] )

Compare string with C string (case insensitive according to the current locale) and return the sort order.

Note: doesn't work with UTF-8 strings.

Parameters
string_1The string 1
cstring_2The cstring 2
Returns
zero if equal

◆ furi_string_empty()

bool furi_string_empty ( const FuriString * string)

Check that string is empty or not.

Parameters
stringThe FuriString instance
Returns
true if empty otherwise false

◆ furi_string_end_with()

bool furi_string_end_with ( const FuriString * string,
const FuriString * end )

Test if the string ends with the given string.

Parameters
stringThe FuriString instance
endThe end
Returns
true if string ends with

◆ furi_string_end_with_str()

bool furi_string_end_with_str ( const FuriString * string,
const char end[] )

Test if the string ends with the given C string.

Parameters
stringThe FuriString instance
endThe end
Returns
true if string ends with

◆ furi_string_end_withi()

bool furi_string_end_withi ( const FuriString * string,
const FuriString * end )

Test if the string ends with the given string (case insensitive according to the current locale).

Parameters
stringThe FuriString instance
endThe end
Returns
true if string ends with

◆ furi_string_end_withi_str()

bool furi_string_end_withi_str ( const FuriString * string,
const char end[] )

Test if the string ends with the given C string (case insensitive according to the current locale).

Parameters
stringThe FuriString instance
endThe end
Returns
true if string ends with

◆ furi_string_equal()

bool furi_string_equal ( const FuriString * string_1,
const FuriString * string_2 )

Test if two strings are equal.

Parameters
string_1The string 1
string_2The string 2
Returns
true if equal false otherwise

◆ furi_string_equal_str()

bool furi_string_equal_str ( const FuriString * string_1,
const char cstring_2[] )

Test if the string is equal to the C string.

Parameters
string_1The string 1
cstring_2The cstring 2
Returns
true if equal false otherwise

◆ furi_string_free()

void furi_string_free ( FuriString * string)

Free FuriString.

Parameters
stringThe FuriString instance to free

◆ furi_string_get_char()

char furi_string_get_char ( const FuriString * string,
size_t index )

Get the character at the given index.

Return the selected character of the string.

Parameters
stringThe FuriString instance
indexThe index
Returns
character at index

◆ furi_string_get_cstr()

const char * furi_string_get_cstr ( const FuriString * string)

Return the string view a classic C string.

Parameters
stringThe FuriString instance
Returns
const C-string, usable till first container change

◆ furi_string_hash()

size_t furi_string_hash ( const FuriString * string)

Compute a hash for the string.

Parameters
stringThe FuriString instance
Returns
hash value

◆ furi_string_left()

void furi_string_left ( FuriString * string,
size_t index )

Trim the string left to the first 'index' bytes.

Parameters
stringThe FuriString instance
indexThe index

◆ furi_string_mid()

void furi_string_mid ( FuriString * string,
size_t index,
size_t size )

Trim the string from position index to size bytes.

See also furi_string_set_n.

Parameters
stringThe FuriString instance
indexThe index
sizeThe size

◆ furi_string_move()

void furi_string_move ( FuriString * string_1,
FuriString * string_2 )

Move string_2 content to string_1.

Set the string to the other one, and destroy the other one.

Parameters
string_1The FuriString instance 1
string_2The FuriString instance 2

◆ furi_string_printf()

int furi_string_printf ( FuriString * string,
const char format[],
... )

Format in the string the given printf format.

Parameters
stringThe string
formatThe format
[in]...The args
Returns
number of characters printed or negative value on error

◆ furi_string_push_back()

void furi_string_push_back ( FuriString * string,
char c )

Append a character to the string.

Parameters
stringThe FuriString instance
cThe character

◆ furi_string_replace()

size_t furi_string_replace ( FuriString * string,
FuriString * needle,
FuriString * replace,
size_t start )

Replace a string 'needle' to string 'replace' in a string from 'start' position.

Parameters
stringThe string
needleThe needle
replaceThe replace
startThe start (By default, start is zero)
Returns
Return FURI_STRING_FAILURE if 'needle' not found or replace position.

◆ furi_string_replace_all()

void furi_string_replace_all ( FuriString * string,
const FuriString * needle,
const FuriString * replace )

Replace all occurrences of 'needle' string into 'replace' string.

Parameters
stringThe string
needleThe needle
replaceThe replace

◆ furi_string_replace_all_str()

void furi_string_replace_all_str ( FuriString * string,
const char needle[],
const char replace[] )

Replace all occurrences of 'needle' C string into 'replace' C string.

Parameters
stringThe string
needleThe needle
replaceThe replace

◆ furi_string_replace_at()

void furi_string_replace_at ( FuriString * string,
size_t pos,
size_t len,
const char replace[] )

Replace in the string the sub-string at position 'pos' for 'len' bytes into the C string 'replace'.

Parameters
stringThe string
posThe position
lenThe length
replaceThe replace

◆ furi_string_replace_str()

size_t furi_string_replace_str ( FuriString * string,
const char needle[],
const char replace[],
size_t start )

Replace a C string 'needle' to C string 'replace' in a string from 'start' position.

Parameters
stringThe string
needleThe needle
replaceThe replace
startThe start (By default, start is zero)
Returns
Return FURI_STRING_FAILURE if 'needle' not found or replace position.

◆ furi_string_reserve()

void furi_string_reserve ( FuriString * string,
size_t size )

Reserve memory for string.

Modify the string capacity to be able to handle at least 'alloc' characters (including final null char).

Parameters
stringThe FuriString instance
sizeThe size to reserve

◆ furi_string_reset()

void furi_string_reset ( FuriString * string)

Reset string.

Make the string empty.

Parameters
stringThe FuriString instance

◆ furi_string_right()

void furi_string_right ( FuriString * string,
size_t index )

Trim the string right from the 'index' position to the last position.

Parameters
stringThe FuriString instance
indexThe index

◆ furi_string_search()

size_t furi_string_search ( const FuriString * string,
const FuriString * needle,
size_t start )

Search the first occurrence of the needle in the string from the position start.

Parameters
stringThe FuriString instance
needleThe needle
startThe start (By default, start is zero)
Returns
position or FURI_STRING_FAILURE if not found

◆ furi_string_search_char()

size_t furi_string_search_char ( const FuriString * string,
char c,
size_t start )

Search for the position of the character c from the position start (include) in the string.

Parameters
stringThe FuriString instance
cThe character
startThe start (By default, start is zero)
Returns
position or FURI_STRING_FAILURE if not found

◆ furi_string_search_rchar()

size_t furi_string_search_rchar ( const FuriString * string,
char c,
size_t start )

Reverse search for the position of the character c from the position start (include) in the string.

Parameters
stringThe FuriString instance
cThe character
startThe start (By default, start is zero)
Returns
position or FURI_STRING_FAILURE if not found

◆ furi_string_search_str()

size_t furi_string_search_str ( const FuriString * string,
const char needle[],
size_t start )

Search the first occurrence of the needle in the string from the position start.

Parameters
stringThe FuriString instance
needleThe needle
startThe start (By default, start is zero)
Returns
position or FURI_STRING_FAILURE if not found

◆ furi_string_set()

void furi_string_set ( FuriString * string,
FuriString * source )

Set the string to the other string.

Set the string to the source string.

Parameters
stringThe FuriString instance
sourceThe source

◆ furi_string_set_char()

void furi_string_set_char ( FuriString * string,
size_t index,
const char c )

Set the character at the given index.

Parameters
stringThe FuriString instance
indexThe index
cThe character

◆ furi_string_set_n()

void furi_string_set_n ( FuriString * string,
const FuriString * source,
size_t offset,
size_t length )

Set the string to the n first characters of other one.

Parameters
stringThe FuriString instance
sourceThe source
offsetThe offset
lengthThe length

◆ furi_string_set_str()

void furi_string_set_str ( FuriString * string,
const char source[] )

Set the string to the other C string.

Set the string to the source C string.

Parameters
stringThe FuriString instance
sourceThe source

◆ furi_string_set_strn()

void furi_string_set_strn ( FuriString * string,
const char source[],
size_t length )

Set the string to the n first characters of the C string.

Parameters
stringThe FuriString instance
sourceThe source
lengthThe length

◆ furi_string_size()

size_t furi_string_size ( const FuriString * string)

Get string size (usually length, but not for UTF-8)

Parameters
stringThe FuriString instance
Returns
size of the string

◆ furi_string_start_with()

bool furi_string_start_with ( const FuriString * string,
const FuriString * start )

Test if the string starts with the given string.

Parameters
stringThe FuriString instance
startThe FuriString instance
Returns
true if string starts with

◆ furi_string_start_with_str()

bool furi_string_start_with_str ( const FuriString * string,
const char start[] )

Test if the string starts with the given C string.

Parameters
stringThe FuriString instance
startThe start
Returns
true if string starts with

◆ furi_string_swap()

void furi_string_swap ( FuriString * string_1,
FuriString * string_2 )

Swap two strings.

Swap the two strings string_1 and string_2.

Parameters
string_1The FuriString instance 1
string_2The FuriString instance 2

◆ furi_string_trim()

void furi_string_trim ( FuriString * string,
const char chars[] )

Trim a string from the given set of characters (default is " \n\r\t").

Parameters
stringThe FuriString instance
charsThe characters

◆ furi_string_utf8_decode()

void furi_string_utf8_decode ( char c,
FuriStringUTF8State * state,
FuriStringUnicodeValue * unicode )

Main generic UTF8 decoder.

It takes a character, and the previous state and the previous value of the unicode value. It updates the state and the decoded unicode value. A decoded unicode encoded value is valid only when the state is FuriStringUTF8StateStarting.

Parameters
cThe character
stateThe state
unicodeThe unicode

◆ furi_string_utf8_length()

size_t furi_string_utf8_length ( FuriString * string)

Compute the length in UTF8 characters in the string.

Parameters
stringThe FuriString instance
Returns
strings size

◆ furi_string_utf8_push()

void furi_string_utf8_push ( FuriString * string,
FuriStringUnicodeValue unicode )

Push unicode into string, encoding it in UTF8.

Parameters
stringThe string
unicodeThe unicode

◆ furi_string_vprintf()

int int furi_string_vprintf ( FuriString * string,
const char format[],
va_list args )

Format in the string the given printf format.

Parameters
stringThe FuriString instance
formatThe format
argsThe arguments
Returns
number of characters printed or negative value on error