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