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

C++ header-only API: C++ string helper functions. More...

`#include "unicode/utypes.h"`
`#include "unicode/utf16.h"`

Go to the source code of this file.

## Functions

template<typename StringClass>
StringClass & | U_HEADER_ONLY_NAMESPACE::utfstring::appendOrFFFD (StringClass &s, UChar32 c)
| Appends the code point to the string.
template<typename StringClass>
StringClass & | U_HEADER_ONLY_NAMESPACE::utfstring::appendUnsafe (StringClass &s, UChar32 c)
| Appends the code point to the string.
template<typename StringClass>
StringClass | U_HEADER_ONLY_NAMESPACE::utfstring::encodeOrFFFD (UChar32 c)
| Returns the code point as a string of code units.
template<typename StringClass>
StringClass | U_HEADER_ONLY_NAMESPACE::utfstring::encodeUnsafe (UChar32 c)
| Returns the code point as a string of code units.

## Detailed Description

C++ header-only API: C++ string helper functions.

Definition in file utfstring.h.

## Function Documentation

## appendOrFFFD()

template<typename StringClass>

StringClass & U_HEADER_ONLY_NAMESPACE::utfstring::appendOrFFFD | ( | StringClass & | s,
|  | UChar32 | c )

inline

Appends the code point to the string.

Appends the U+FFFD replacement character instead if c is not a scalar value. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  s | The string to append to
  c | The code point to append

Returns
  s

Draft
  This API may be changed in the future versions and was introduced in ICU 78

See also
  U_IS_SCALAR_VALUE

Definition at line 98 of file utfstring.h.

## appendUnsafe()

template<typename StringClass>

StringClass & U_HEADER_ONLY_NAMESPACE::utfstring::appendUnsafe | ( | StringClass & | s,
|  | UChar32 | c )

inline

Appends the code point to the string.

The code point must be a scalar value; otherwise the behavior is undefined. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  s | The string to append to
  c | The code point to append (must be a scalar value)

Returns
  s

Draft
  This API may be changed in the future versions and was introduced in ICU 78

See also
  U_IS_SCALAR_VALUE

Definition at line 115 of file utfstring.h.

## encodeOrFFFD()

template<typename StringClass>

StringClass U_HEADER_ONLY_NAMESPACE::utfstring::encodeOrFFFD | ( | UChar32 | c | ) |

inline

Returns the code point as a string of code units.

Returns the U+FFFD replacement character instead if c is not a scalar value. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  c | The code point

Returns
  the string of c's code units

Draft
  This API may be changed in the future versions and was introduced in ICU 78

See also
  U_IS_SCALAR_VALUE

Definition at line 131 of file utfstring.h.

## encodeUnsafe()

template<typename StringClass>

StringClass U_HEADER_ONLY_NAMESPACE::utfstring::encodeUnsafe | ( | UChar32 | c | ) |

inline

Returns the code point as a string of code units.

The code point must be a scalar value; otherwise the behavior is undefined. See https://www.unicode.org/glossary/#unicode_scalar_value

Template Parameters

  StringClass | A version of std::basic_string (or a compatible type)

Parameters

  c | The code point

Returns
  the string of c's code units

Draft
  This API may be changed in the future versions and was introduced in ICU 78

See also
  U_IS_SCALAR_VALUE

Definition at line 149 of file utfstring.h.