### Using su::List Class Instance (C++) Source: https://github.com/gyverlibs/stringutils/blob/main/README.md Provides an example of creating and using an instance of the `su::List` class. Shows how to get the list length, access elements by index using the `[]` operator, find the index of a substring, and parse the list content into an integer array. ```cpp su::List list(F("123;456;333")); Serial.print("len: "); Serial.println(list.length()); // 3 Serial.print("index 2: "); Serial.println(list[2]); // 333 Serial.print("index of '456':"); Serial.println(list.indexOf(F("456"))); // 1 Serial.print("index of '789':"); Serial.println(list.indexOf("789")); // -1 // переписать в массив int arr[3]; list.parse(arr, 3); ``` -------------------------------- ### SU::Splitter Example Usage Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Provides an example demonstrating how to use SU::Splitter to split a string and access tokens by index. It also shows the importance of calling restore() to return delimiters to the original string. ```C++ Char Buf [] = "123; 456; ABC"; SU :: Splitter SPL (BUF); for (uint8_t i = 0; i uint16_t SU :: list :: Parse (Text List, T* Buf, Uint16_t Len, Char Div = ';'); ``` -------------------------------- ### Defining su::List Class (C++) Source: https://github.com/gyverlibs/stringutils/blob/main/README.md Defines the public interface for the `su::List` class, which provides methods for working with delimited strings without modifying the original. Includes methods for setting the delimiter, getting length, finding elements, retrieving elements by index, and parsing into an array. ```cpp List(Text); // установить разделител void setDiv(char div); // получить размер списка uint16_t length(); // получить индекс подстроки в списке или -1 если её нет int16_t indexOf(Text str); // проверить наличие подстроки в списке bool includes(Text str); // получить подстроку под индеком Text get(uint16_t idx); // распарсить в массив указанного типа и размера. Вернёт количество записанных подстрок template uint16_t parse(T* buf, uint16_t len); ``` -------------------------------- ### SU::List Class Definition (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Provides the interface definition for the SU::List class, which allows obtaining settings from a delimited string without modifying the original. It includes methods for setting the delimiter, getting length, finding index, checking inclusion, getting elements by index, and parsing into an array. ```CPP List (Text); // Install the separator VOID Setdiv (Char Div); // get the size of the list uint16_t Length (); // Get the tuning index in the list or -1 if it is not Int16_t Indexof (Text Str); // Check the availability of tuning in the list Bool Includes (Text Str); // Get the tuning under the index Text Get (Uint16_T IDX); // Parrow in an array of the specified type and size.Will return the number of recorded tuning TEMPLATE uint16_t Parse (t* buf, uint16_t len); ``` -------------------------------- ### Parsing Name-Index-Value Protocol with Text Class - C++ Source: https://github.com/gyverlibs/stringutils/blob/main/README.md This example illustrates parsing a 'name/index/value' protocol string. It extracts the value and index using getSub, converts the value to an integer, and the index to an int16. The name is hashed using hash() and su::SH() for the outer switch, while the index is used in a nested switch for handling specific cases based on the index value. ```cpp Text txt("key/3/1234"); int val = txt.getSub(2, '/'); switch (txt.getSub(0, '/').hash()) { case su::SH("key"): switch(txt.getSub(1, '/').toInt16()) { case 0: break; case 1: break; case 2: break; //..... } break; case su::SH("keykey"): //... break; case su::SH("anotherKey"): //... break; } ``` -------------------------------- ### Basic SU::Text Usage in C++ Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Demonstrates initialization, assignment, comparison, type conversion (to int, String), printing to char array, parsing substrings, and splitting into arrays of SU::Text or other types. Also highlights potential pitfalls with temporary String objects and changing String addresses. ```CPP // Designer SU :: Text V0 ("-123456"); SU :: text v1 = "-123456"; v1 = f ("-123456"); String S ("ABCD"); SU :: text v2 (s); v2 = s; // Comparison v2 == v1; v2 == F ("Text"); v1 == -123456; // Auto Convertation int V = v0; String S2 = V2; // Conclusion in the array Char Buf [20]; v1.tostr (buf); // Parsing and separation SU :: TEXT LIST ("ABC/123/Def"); Serial.println (libetsub (0, '/'));// ABC Serial.println (libetsub (2, '/'));// Def Serial.println (list.substring (4, 6));// 123 SU :: Text Arr [3]; list.split (arr, 3, '/'); Serial.println (arr [0]); Serial.println (arr [1]); Serial.println (arr [2]); // you can parse in any type int arr2 [3];// Float, byte ... list.split (arr2, 3, '/'); Serial.println (arr2 [0]); Serial.println (arr2 [1]); Serial.println (arr2 [2]); // you can't do this Text T1 (String ("123"));// The line will be unloaded from memory! // t1 .... the program will break String S; Text T1 (S); S += string ("123");// The line address will change! // t1 .... the program will break // at the same time like this - you can VOID FOO (COST Text & Text) { // String exists here Print (Text); } FOO (String ("123")); ``` -------------------------------- ### Using SU::List Object Methods (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Shows how to create an instance of the SU::List class and use its methods like length(), indexof(), and the array access operator [] to interact with the list data. It also demonstrates parsing the list content into an integer array. ```CPP SU :: List List ("" 123; 456; 333 ")); Serial.print ("len:"); Serial.println (list.length ());// 3 Serial.print ("index 2:"); Serial.println (list [2]);// 333 Serial.print ("index of '456':"); Serial.println (list.indexof (f ("456")));// 1 Serial.print ("Index of '789':"); Serial.println (List.indexof ("789"));// -1 // rewrite in an array int arr [3]; List.parse (Arr, 3); ``` -------------------------------- ### Using SU::Text via Inheritance Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Demonstrates inheriting from SU::Text to allow a class to manage an internal buffer and expose it directly as a Text object, simplifying access and output. ```C++ Class Myclass: Public Su :: Text { Public: VOID FOO () { SU :: Text :: _ str = buffer; SU :: Text :: _ len = somelen; } Private: Char Buffer [20]; }; Myclass S; Serial.println (s); ``` -------------------------------- ### Parsing Key-Value Protocol with SU::Text in C++ Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Shows how to parse a "key=value" string using getsub to extract parts and hash with a switch statement to identify the key and assign the value to a variable. ```CPP Text Txt ("Key1 = 1234"); int val = txt.getsub (1, '=');// Value in int switch (txt.getsub (0, '='). Hash ()) {// Key hash Case Su :: SH ("Key1"): VAR1 = Val; Break; Case Su :: SH ("Key2"): Var2 = Val; Break; Case Su :: SH ("Key3"): Var2 = Val;Break; } ``` -------------------------------- ### Parsing Name-Index-Value Protocol with SU::Text in C++ Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Illustrates parsing a "name/index/value" string using getsub to extract components. It uses hash for the name key and toInt16 for the index, demonstrating nested switch statements for handling structured protocols. ```CPP Text Txt ("Key/3/1234"); into val = txt.getsub (2, '/'); switch (txt.getsub (0, '/'). Hash ()) { Case Su :: SH ("Key"): switch (txt.getsub (1, '/'). Toint16 ()) { Case 0: Break; Case 1: Break; Case 2: Break; // ..... } Break; Case Su :: SH ("KeyKey"): // ... Break; Case Su :: SH ("Anotherkey"): // ... Break; } ``` -------------------------------- ### SU::Value Constructors for Various Types in C++ Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Lists the available constructors for the SU::Value class, showing how it can be initialized with various standard data types (boolean, char, int, long, double, etc.) and how to specify the base for integer conversions or decimal places for doubles. It also mentions constructors for manual buffer sizing. ```CPP SU :: Value (Bool Value); SU :: Value (Char + Unsigned Value, Uint8_t Base = Dec); SU :: Value (Short + Unsigned Value, Uint8_t Base = Dec); SU :: value (int + Unsigned Value, Uint8_t Base = Dec); SU :: Value (Long + Unsigned Value, Uint8_t Base = Dec); SU :: Value (Long Long + Unsigned Value, Uint8_t Base = Dec); SU :: Value (Double Value, Uint8_t Dec = 2); // similarly with a manual sizes of the buffer SU :: valuet (); ``` -------------------------------- ### Basic SU::Value Usage in C++ Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Demonstrates initializing SU::Value from strings and various data types, assigning new values, comparing SU::Value objects with each other and with different string types (SU::Text, const char*, String), converting SU::Value to other data types (float, int), and printing its content to String or char[]. ```CPP SU :: Value V0 ("-123456");// all lines can also be SU :: Value V1 (123); SU :: Value V2 (3.14); SU :: Value V3 ((Uint64_T) 12345678987654321); // converted from among the text v1 = 10; v1 = 3.14; V1 = 12345654321ULL; Serial.println (v0);// printed in Serial Serial.println (v1 == v2);// compared // compared with any line SU :: Text S ("123"); String ss = "123"; Serial.println (s == "123"); Serial.println (s == f ("123")); Serial.println (s == SS); // converted into any type Float F = V2;// f == 3.14 int i = v1;// I = 123 // displayed in string String S; v0.tostring (s); // displayed in Char [] Char buf [v1.length () + 1];// +1 for '\ 0' v1.tostr (buf); ``` -------------------------------- ### Using su::PrintString Class (C++) Source: https://github.com/gyverlibs/stringutils/blob/main/README.md Illustrates the usage of the `su::PrintString` class, which acts like a standard `String` but allows printing formatted data into it using `print` and `println` methods, similar to `Serial`. ```cpp // строка, в которую можно делать print/println su::PrintString prs; prs += "как обычный String"; prs.print(10); prs.println("hello"); prs.print(F("print!")); Serial.println(prs); ``` -------------------------------- ### Returning SU::Text View from Class Method Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Shows how a class can store data in an internal buffer and return a view of that buffer using SU::Text, avoiding copying the data when returning it. ```C++ Class myclass { Public: SU :: text get () { Return Su :: Text (Buffer, Len); } Private: Char Buffer [20]; int len; }; Myclass S; Serial.println (S.Get ()); ``` -------------------------------- ### SU::TOQWERTY Layout Conversion (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Provides the function signatures for converting Russian text layout to QWERTY layout. It includes versions for String objects and C-style character arrays, noting that the character array version requires a buffer large enough for the result plus a null terminator. ```CPP // change the layout (ru in Qwerty) - String String SU :: TOQWERTY (COST String & RU); // Change the layout (ru in QWERTY) - Char* (QW length as ru + 1, the function will add '\ 0') Char* SU :: Toqwerty (Const Char* Ru, Char* QW); ``` -------------------------------- ### SU::Hash String Hashing (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Describes the string hashing functions provided by the SU namespace. It differentiates between compile-time (Contexpr SH, SH32) and runtime (Hash, hash32, hash_p, hash32_p) hash calculation functions, explaining that compile-time hashes replace the string literal with the hash value in the compiled code. Includes versions for standard and Progmem strings. ```CPP // is considered a compiler Contexpr SU :: Size_t Su :: SH (const chaar* str);// (String Hash) Size_t size Contexpr SU :: size_t SH32 (COST Char* str);// (String Hash) Size 32 bits // is considered in the radim Size_t Su :: Hash (const char* str, int16_t len = -1);// size depends on the platform and corresponds to size_t uint32_t SU :: hash32 (const char* str, int16_t len = -1);// size 32 bits Size_t Su :: hash_p (pgm_p str, int16_t len = -1);// Progmem line, size size_t uint32_t SU :: hash32_p (pgm_p str, int16_t len = -1);// Progmem line, size 32 bits ``` -------------------------------- ### Defining su::toQwerty Functions (C++) Source: https://github.com/gyverlibs/stringutils/blob/main/README.md Declares overloaded functions `su::toQwerty` for converting Russian layout strings to QWERTY layout. Provides versions for both `String` objects and C-style character arrays. ```cpp // Изменить раскладку (RU в QWERTY) - String String su::toQwerty(const String& ru); // Изменить раскладку (RU в QWERTY) - char* (qw длина как ru + 1, функция добавит '\0') char* su::toQwerty(const char* ru, char* qw); ``` -------------------------------- ### Using SU::Printstring (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Illustrates the usage of the SU::Printstring class, which acts like a string buffer allowing data to be appended using +=, print(), and println() methods, similar to Serial.print. The accumulated content can then be printed or accessed as a string. ```CPP // line in which you can make Print/Println SU :: Printstring PRS; PRS += "As a regular string"; PRS.Print (10); PRS.println ("Hello"); PRS.Print (F ("Print!")); Serial.println (PRS); ``` -------------------------------- ### Listing Other String Utility Functions - CPP Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Provides a list of function signatures for various string utility functions available in the library. These include functions for calculating string length (including multi-byte characters), determining number length, converting between strings and numbers (integers, floats, hex), and basic math utilities. ```CPP // Line length with Russian symbols uint16_t SU :: strlenru (const chaar* str); // Get the length of the whole number uint8_t SU :: intlen (int32_t val); // Get the length of Float numbers uint8_t SU :: floatlen (Double Val, Uint8_t Dec); // Transform the line into a whole number TEMPLATE T Su :: strtoint (const char* str, uint8_t len = 0); // Transforming ProgmemMem a line into a whole number TEMPLATE T Su :: Strtoint_p (Consta Char* str, uint8_t len = 0); // Transform Float into a line indicating the number of signs after the point uint8_t SU :: floattostr (Double val, char* buf, uint8_t dec = 2); // Transform HEX line into a whole number.Optional length Uint32_T SU :: Strtointhex (const char* str, int8_t len = -1); // The length of the symbol in the number of bytes uint8_t SU :: Charsize (Char Sym); // Conversion of the number in Char* array.Writes from the beginning of the array, adds '\ 0', will return the length of the line // for int64 max.Boofer length - 22 characters, for Int32 - 12 uint8_t SU :: uinttostr (uint32_t n, char* buf, uint8_t base = dec); uint8_t SU :: inttostr (int32_t n, char* buf, uint8_t base = dec); uint8_t SU :: uint64tostr (uint64_t n, char* buf, uint8_t base = dec); uint8_t SU :: int64tostr (int64_t n, char* buf, uint8_t base = dec); // Convertation from a line in Float Float Su :: Strtofloat (Consta Char* S); // Convertation from Progemem Lines to Float Float SU :: strtofloat_p (pgm_p s); // Quick integer logarithm 10 (length of the number in the number of symbols) uint8_t SU :: getlog10 (uint32_t value); uint8_t SU :: getlog10 (int32_t value); // quick construction 10 to degree uint32_t SU :: getpow10 (uint8_t value); ``` -------------------------------- ### SU::Text String Conversion Methods Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Provides methods to convert the SU::Text content into standard C++ String objects or copy it into a character buffer. Options are available for decoding Unicode and specifying buffer size and null termination. ```CPP // ======== conclusion.Lines ========= // Get like string string String Tostring (Bool Decodeunicode = False); // Bring out a string line.Will return FALSE in case of failure Bool Tostring (String & S, Bool Decodeunicode = False); // Add to string line.Will return FALSE in case of failure Bool Addstring (String & S, Bool Decodeunicode = False); // Bring out an array.Return the length of the line.Terminate - complete the line with zero uint16_t Tostr (char* buf, int16_t bufsize = -1, bool terminate = true); ``` -------------------------------- ### Parsing Key-Value Protocol with Text Class - C++ Source: https://github.com/gyverlibs/stringutils/blob/main/README.md This snippet demonstrates how to parse a simple 'key=value' protocol string using the Text class. It extracts the value as an integer using getSub and converts the key to a hash using the hash() method and su::SH() macro for efficient comparison within a switch statement, allowing assignment to different variables based on the key. ```cpp Text txt("key1=1234"); int val = txt.getSub(1, '='); // значение в int switch (txt.getSub(0, '=').hash()) { // хэш ключа case su::SH("key1"): var1 = val; break; case su::SH("key2"): var2 = val; break; case su::SH("key3"): var2 = val; break; } ``` -------------------------------- ### SU::Text Base64 Methods Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Methods specifically for handling content that is Base64 encoded. It allows determining the size of the decoded data and decoding the Base64 string into a provided memory buffer. ```CPP // ======== conclusion.B64 ========= // data size (byte) if they are b64 Size_T SIZEB64 (); // Bend from b64 Bool Decodeb64 (Void* var, size_t size); ``` -------------------------------- ### Comparing Strings with Hash (Optimized Method) - CPP Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Illustrates an optimized string comparison method using hashing. It calculates the hash of the input buffer and compares it against pre-calculated hashes of target strings using a switch statement. This method can be faster than direct string comparison on some platforms. ```CPP Using SU :: SH; Using SU :: HASH; Char buf [] = "some_text"; switch (hash (buf)) { Case Su :: SH ("ABCDEF"): Serial.Println (0);Break; Case Su :: SH ("12345"): serial.println (1);Break; Case Su :: SH ("Wrong Text"): Serial.Println (2);Break; Case Su :: SH ("Some Text"): Serial.Println (3);Break; Case Su :: SH ("Hello"): serial.println (4);Break; Case Su :: SH ("SOME_TEXT"): Serial.PRINTLN (5);Break; } ``` -------------------------------- ### SU::Text Hash Methods Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Methods for calculating hash values of the text content. It provides options for generating a size_t hash or a 32-bit unsigned integer hash. ```CPP // ======== Hash ============ size_t hash ();// Hash lines size_t uint32_t hash32 ();// Hash lines 32 bits ``` -------------------------------- ### SU::Text Constructors (Designer) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md These constructors allow creating SU::Text objects from various C++ string representations, including String objects, const String references, flash strings (__FlashStringHelper), and character arrays (const char*), with options for specifying length and PROGMEM location. ```CPP // ====== Designer ========= SU :: Text (String & Str); SU :: Text (Constation String & Str); SU :: text (const __flashstringhelper* str, int16_t len = 0); SU :: Text (const char* str, int16_t len = 0, bool pgm = 0); ``` -------------------------------- ### SU::B64 Base64 Encoding/Decoding (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Lists the function signatures for Base64 encoding and decoding operations within the SU::B64 namespace. It includes functions to calculate encoded/decoded lengths and perform encoding/decoding for both String and character array types, with an option for Progmem data. ```CPP // The size of coded data in terms of source Size_T SU :: B64 :: Encodedlen (Size_t Len); // Future size of decoded data on line b64 and its length Size_T SU :: b64 :: decodedlen (const char* b64, size_t len); // encode data in string VOID SU :: B64 :: Encode (String* B64, Uint8_T* DATA, SIZE_T LEN, BOL PGM = FALSE); // encode data in char [] (the library does not add '\ 0' to the end) VOID SU :: B64 :: Encode (Char* B64, Uint8_T* DATA, SIZE_T LEN, BOOL PGM = FALSE); // Express data from line B64 to DATA buffer VOID SU :: b64 :: decode (uint8_t* data, constel* b64, size_t len); VOID SU :: b64 :: decode (uint8_t* Data, Consta String & B64); ``` -------------------------------- ### SU::Textlist Dynamic Class Definition Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Defines the constructors and methods for the dynamic version of SU::Textlist, which parses a Text string into a list of Text views based on a delimiter, allocating memory on the heap for internal structures. ```C++ Textlist (Text List, Char Div); Textlist (Text List, Text Div); // number of construction uint16_t Length (); // Get the tuning under the index COST Text & Get (Uint16_T IDX); constaT & operator [] (int IDX); ``` -------------------------------- ### Efficient String Concatenation with SU::Text Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Illustrates the solution using SU::Text's Addstring method. This approach avoids creating copies of the input string, making concatenation faster and safer by preventing dynamic memory re-allocations and fragmentation. ```C++ VOID Settext // and for example add to the line str.Addstring (s); } ``` -------------------------------- ### SU::Textlistt Static Class Definition Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Defines the constructors and methods for the static version of SU::Textlistt, which parses a Text string into a list of Text views based on a delimiter, with a fixed capacity determined at compile time. ```C++ Textlistt (Text List, Char Div); Textlistt (Text List, Text Div); // number of construction uint16_t Length (); // buffer size Uint16_T Capacy (); // Get the tuning under the index COST Text & Get (Uint16_T IDX); constaT & operator [] (int IDX); ``` -------------------------------- ### Defining URL Functions (C++) Source: https://github.com/gyverlibs/stringutils/blob/main/README.md Defines functions for URL encoding and decoding. Includes functions to check if a character needs encoding, and overloaded functions for encoding/decoding between C-style strings and `String` objects. ```cpp // символ должен быт ``` -------------------------------- ### Comparing Strings with strcmp_p (Classic Method) - CPP Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Demonstrates the classic method for comparing a character buffer against predefined strings stored in program memory (Progmem) using the strcmp_p function. It checks for a match against several possible strings and prints an index based on the match. ```CPP Char buf [] = "some_text"; if (! strcmp_p (buf, pstr ("abcDef"))) serial.println (0); Else if (! Strcmp_p (BUF, PSTR ("12345"))) serial.println (1); Else if (! Strcmp_p (BUF, PSTR ("Wrong Text"))) serial.println (2); Else if (! Strcmp_p (BUF, PSTR ("SOME Text"))) serial.println (3); Else if (! Strcmp_p (Buf, Pstr ("Hello"))) SErial.println (4); Else if (! Strcmp_p (BUF, PSTR ("SOME_TEXT"))) serial.PRINTLN (5); ``` -------------------------------- ### SU::url Encoding/Decoding (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Outlines the SU::url functions for URL encoding and decoding. It includes a helper function NEEDSENCODE to check if a character requires encoding and provides overloaded functions for encoding/decoding using character arrays and String objects. ```CPP // Symbol should be urlencode Bool Su :: url :: NEEDSENCODE (Char C); // encode in the URL VOID SU :: url :: Encode (Consta Char* SRC, Uint16_t Len, String & Dest); VOID SU :: url :: Encode (Const String & SRC, String & Dest); String SU :: url :: Encode (Const String & SRC); // Report the URL VOID SU :: url :: decode (Consta Char* SRC, UINT16_T LEN, String & DEST); VOID SU :: url :: decode (Const String & SRC, String & Dest); String SU :: url :: decode (Const String & SRC); ``` -------------------------------- ### Problematic Arduino String Concatenation Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Demonstrates a common pattern in vanilla Arduino using the String class for concatenation, which leads to string duplication and dynamic memory allocation, potentially causing fragmentation. ```C++ VOID Settext // and for example add to the line S += str; } ``` -------------------------------- ### Defining Base64 Functions (C++) Source: https://github.com/gyverlibs/stringutils/blob/main/README.md Defines a set of functions for Base64 encoding and decoding. Includes functions to calculate encoded/decoded lengths and perform encoding/decoding for various data types and destinations (String, char array, uint8_t array). ```cpp // размер закодированных данных по размеру исходных size_t encodedLen(size_t len); // будущий размер декодированных данных по строке b64 и её длине size_t decodedLen(const char* b64, size_t len); // закодировать данные в String size_t encode(String* b64, uint8_t* data, size_t len, bool pgm = false); // закодировать данные в char[] (библиотека не добавляет '\0' в конец) size_t encode(char* b64, uint8_t* data, size_t len, bool pgm = false); // раскодировать данные из строки b64 длиной len в буфер data size_t decode(uint8_t* data, const char* b64, size_t len); // раскодировать данные из строки b64 длиной len в саму себя, добавит 0 на конце size_t decode(char* b64, size_t len); // раскодировать данные из строки b64 в буфер data size_t decode(uint8_t* data, const String& b64); ``` -------------------------------- ### SU::Splitter Class Definition (Outdated) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Defines the constructors and methods for the SU::Splitter class, another older utility for splitting a string into tokens. It modifies the original string by replacing delimiters and requires explicit restoration. ```C++ SU :: Splittert SPL (string & str, char div = ';'); SU :: Splittert SPL (const char* str, char div = ';'); SU :: Splitter Spl (String & Str, Char Div = ';');// Auto-size (released in Heap) SU :: Splitter SPL (Consta Char* str, char div = ';');// Auto-size (released in Heap) VOID Setdiv (Char Div);// Install the separator VOID restore ();// Restore the line (return the dividers) uint8_t leength ();// Number of tuning const char* str (uint16_t IDX);// Get the tuning on the index Text Get (Uint16_T IDX);// Get a t in the index as a Text ``` -------------------------------- ### Calling Problematic Arduino String Function Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Shows how the problematic Settext function (using Arduino String) can be called with various string types (literals, F-strings, char arrays, String objects), all potentially causing memory issues. ```C++ Settext ("Constal"); Settext (F ("F-String")); Char str [] = "Buffer string"; Settext (str); String s = "arduino string"; settext (s); ``` -------------------------------- ### SU::Text Number Conversion Methods Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Methods to interpret the text content as various numeric types, including boolean, signed and unsigned integers of different sizes, hexadecimal integers, and floating-point numbers. These methods attempt to parse the string content into the target numeric format. ```CPP // ======== conclusion.Numbers ======== Bool Tobool ();// get a value as bool int16_t toint16 ();// get a value as int16 int32_t toint32 ();// get a value as int32 int64_t toint64 ();// get a value as int64 uint32_t toint32hex ();// get a value as uint 32 from HEX line Float Tofloat ();// get a value as Float ``` -------------------------------- ### SU::Text Print Method Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Allows printing the content of the SU::Text object to any object derived from the Print class, such as Serial or a display object. The method returns the number of bytes printed. ```CPP // ======== Print ========== Size_t Printto (Print & P);// Print in Print (from length) ``` -------------------------------- ### SU::Parser Class Definition (Outdated) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Defines the constructors and methods for the SU::Parser class, an older utility for iterating through tokens in a string. It temporarily modifies the original string by replacing delimiters but restores them upon destruction or completion. ```C++ SU :: Parser P (String & Str, Char Div = ';'); SU :: Parser p (const char* str, char div = ';'); Bool Next ();// Parish the next tuning.Will return FALSE if Parsing is over uint8_t index ();// current tuning index const char* str ();// Get tuning Text get ();// Get a tone as a Text ``` -------------------------------- ### Defining Unicode Functions (C++) Source: https://github.com/gyverlibs/stringutils/blob/main/README.md Declares functions within the `su::unicode` namespace for decoding strings containing `\uXXXX` escape sequences and common escape characters (`\t`, `\r`, `\n`), and for encoding a Unicode code point into its `\uXXXX` representation. ```cpp // декодировать строку.Зарезервировать строку на длину len. Иначе - по длине строки String su::unicode::decode(const char* str, uint16_t len = 0); // декодировать строку String su::unicode::decode(const String& str); // кодировать unicode символ по его коду. В массиве должно быть 5 ячеек void su::unicode::encode(char* str, uint32_t c); // кодировать unicode символ по его коду String su::unicode::encode(uint32_t code); ``` -------------------------------- ### SU::unicode Encoding/Decoding (CPP) Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md Describes the SU::unicode functions for decoding strings containing \uXXXX Unicode escapes and common escape sequences like \t, \r, \n. It also provides functions for encoding a Unicode code point into a string representation. Includes versions for String and character arrays. ```CPP // Decoding the line. Remember the line for LEN length.Otherwise - along the length of the line String SU :: unicode :: decode (const char* str, uint16_t len = 0); // Decoding the line String Su :: Unicode :: Decode (Const String & Str); // Cod the Unicode symbol by its code.There should be 5 cells in the array VOID SU :: unicode :: Encode (char* str, uint32_t c); // Coding Unicode symbol by its code String Su :: Unicode :: Encode (uint32_t code); ``` -------------------------------- ### SU::Text Manual Control Members Source: https://github.com/gyverlibs/stringutils/blob/main/README_EN.md These are internal members that hold the pointer to the string data and its length. They are intended for manual control or inspection of the underlying data representation. ```CPP // for manual line control const Char* _str;// indicator to the line uint16_t _len;// length ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.