1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_string-api: 2*61c4878aSAndroid Build Coastguard Worker 3*61c4878aSAndroid Build Coastguard Worker============= 4*61c4878aSAndroid Build Coastguard WorkerAPI Reference 5*61c4878aSAndroid Build Coastguard Worker============= 6*61c4878aSAndroid Build Coastguard Worker.. pigweed-module-subpage:: 7*61c4878aSAndroid Build Coastguard Worker :name: pw_string 8*61c4878aSAndroid Build Coastguard Worker 9*61c4878aSAndroid Build Coastguard Worker-------- 10*61c4878aSAndroid Build Coastguard WorkerOverview 11*61c4878aSAndroid Build Coastguard Worker-------- 12*61c4878aSAndroid Build Coastguard WorkerThis module provides two types of strings and utility functions for working 13*61c4878aSAndroid Build Coastguard Workerwith strings. 14*61c4878aSAndroid Build Coastguard Worker 15*61c4878aSAndroid Build Coastguard Worker**pw::StringBuilder** 16*61c4878aSAndroid Build Coastguard Worker 17*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/string_builder.h 18*61c4878aSAndroid Build Coastguard Worker :sections: briefdescription 19*61c4878aSAndroid Build Coastguard Worker 20*61c4878aSAndroid Build Coastguard Worker**pw::InlineString** 21*61c4878aSAndroid Build Coastguard Worker 22*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/string.h 23*61c4878aSAndroid Build Coastguard Worker :sections: briefdescription 24*61c4878aSAndroid Build Coastguard Worker 25*61c4878aSAndroid Build Coastguard Worker**String utility functions** 26*61c4878aSAndroid Build Coastguard Worker 27*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/util.h 28*61c4878aSAndroid Build Coastguard Worker :sections: briefdescription 29*61c4878aSAndroid Build Coastguard Worker 30*61c4878aSAndroid Build Coastguard Worker**UTF-8 Helpers** 31*61c4878aSAndroid Build Coastguard Worker 32*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/utf_codecs.h 33*61c4878aSAndroid Build Coastguard Worker :sections: briefdescription 34*61c4878aSAndroid Build Coastguard Worker 35*61c4878aSAndroid Build Coastguard Worker----------------- 36*61c4878aSAndroid Build Coastguard Workerpw::StringBuilder 37*61c4878aSAndroid Build Coastguard Worker----------------- 38*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/string_builder.h 39*61c4878aSAndroid Build Coastguard Worker :sections: briefdescription 40*61c4878aSAndroid Build Coastguard Worker.. doxygenclass:: pw::StringBuilder 41*61c4878aSAndroid Build Coastguard Worker :members: 42*61c4878aSAndroid Build Coastguard Worker 43*61c4878aSAndroid Build Coastguard Worker---------------- 44*61c4878aSAndroid Build Coastguard Workerpw::InlineString 45*61c4878aSAndroid Build Coastguard Worker---------------- 46*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/string.h 47*61c4878aSAndroid Build Coastguard Worker :sections: detaileddescription 48*61c4878aSAndroid Build Coastguard Worker 49*61c4878aSAndroid Build Coastguard Worker.. doxygenclass:: pw::InlineBasicString 50*61c4878aSAndroid Build Coastguard Worker :members: 51*61c4878aSAndroid Build Coastguard Worker 52*61c4878aSAndroid Build Coastguard Worker.. doxygentypedef:: pw::InlineString 53*61c4878aSAndroid Build Coastguard Worker 54*61c4878aSAndroid Build Coastguard Worker------------------------ 55*61c4878aSAndroid Build Coastguard WorkerString utility functions 56*61c4878aSAndroid Build Coastguard Worker------------------------ 57*61c4878aSAndroid Build Coastguard Worker 58*61c4878aSAndroid Build Coastguard Workerpw::string::Assign() 59*61c4878aSAndroid Build Coastguard Worker-------------------- 60*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::Assign(InlineString<> &string, std::string_view view) 61*61c4878aSAndroid Build Coastguard Worker 62*61c4878aSAndroid Build Coastguard Workerpw::string::Append() 63*61c4878aSAndroid Build Coastguard Worker-------------------- 64*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::Append(InlineString<>& string, std::string_view view) 65*61c4878aSAndroid Build Coastguard Worker 66*61c4878aSAndroid Build Coastguard Workerpw::string::ClampedCString() 67*61c4878aSAndroid Build Coastguard Worker---------------------------- 68*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::ClampedCString(const char* str, size_t max_len) 69*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::ClampedCString(span<const char> str) 70*61c4878aSAndroid Build Coastguard Worker 71*61c4878aSAndroid Build Coastguard Workerpw::string::Copy() 72*61c4878aSAndroid Build Coastguard Worker------------------ 73*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::Copy(const char* source, char* dest, size_t num) 74*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::Copy(const char* source, Span&& dest) 75*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::Copy(std::string_view source, Span&& dest) 76*61c4878aSAndroid Build Coastguard Worker 77*61c4878aSAndroid Build Coastguard WorkerIt also has variants that provide a destination of ``pw::Vector<char>`` 78*61c4878aSAndroid Build Coastguard Worker(see :ref:`module-pw_containers` for details) that do not store the null 79*61c4878aSAndroid Build Coastguard Workerterminator in the vector. 80*61c4878aSAndroid Build Coastguard Worker 81*61c4878aSAndroid Build Coastguard Worker.. cpp:function:: StatusWithSize Copy(std::string_view source, pw::Vector<char>& dest) 82*61c4878aSAndroid Build Coastguard Worker.. cpp:function:: StatusWithSize Copy(const char* source, pw::Vector<char>& dest) 83*61c4878aSAndroid Build Coastguard Worker 84*61c4878aSAndroid Build Coastguard Workerpw::string::Format() 85*61c4878aSAndroid Build Coastguard Worker-------------------- 86*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/format.h 87*61c4878aSAndroid Build Coastguard Worker :sections: detaileddescription 88*61c4878aSAndroid Build Coastguard Worker 89*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::Format(span<char> buffer, const char* format, ...) 90*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::FormatVaList(span<char> buffer, const char* format, va_list args) 91*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::Format(InlineString<>& string, const char* format, ...) 92*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::FormatVaList(InlineString<>& string, const char* format, va_list args) 93*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::FormatOverwrite(InlineString<>& string, const char* format, ...) 94*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::FormatOverwriteVaList(InlineString<>& string, const char* format, va_list args) 95*61c4878aSAndroid Build Coastguard Worker 96*61c4878aSAndroid Build Coastguard Workerpw::string::NullTerminatedLength() 97*61c4878aSAndroid Build Coastguard Worker---------------------------------- 98*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::NullTerminatedLength(const char* str, size_t max_len) 99*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::NullTerminatedLength(span<const char> str) 100*61c4878aSAndroid Build Coastguard Worker 101*61c4878aSAndroid Build Coastguard Workerpw::string::PrintableCopy() 102*61c4878aSAndroid Build Coastguard Worker--------------------------- 103*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::string::PrintableCopy(std::string_view source, span<char> dest) 104*61c4878aSAndroid Build Coastguard Worker 105*61c4878aSAndroid Build Coastguard Worker------------- 106*61c4878aSAndroid Build Coastguard WorkerUTF-8 Helpers 107*61c4878aSAndroid Build Coastguard Worker------------- 108*61c4878aSAndroid Build Coastguard Worker.. doxygenfile:: pw_string/utf_codecs.h 109*61c4878aSAndroid Build Coastguard Worker :sections: detaileddescription 110*61c4878aSAndroid Build Coastguard Worker 111*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::utf8::EncodeCodePoint(uint32_t code_point) 112*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::utf8::WriteCodePoint(uint32_t code_point, pw::StringBuilder& output) 113*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::utf8::ReadCodePoint(std::string_view str) 114