Open Chinese Convert: opencc::UTF8Util Class Reference

Open Chinese Convert 1.1.3 A project for conversion between Traditional and Simplified Chinese

Static Public Member Functions | List of all members
opencc::UTF8Util Class Reference
OpenCC C++ Comprehensive API

UTF8 std::string utilities. More...

`#include <UTF8Util.hpp>`

## Static Public Member Functions
static void | SkipUtf8Bom (FILE *fp)
| Detect UTF8 BOM and skip it.
static size_t | NextCharLengthNoException (const char *str)
| Returns the length in byte for the next UTF8 character. More...
static size_t | NextCharLength (const char *str)
| Returns the length in byte for the next UTF8 character.
static size_t | PrevCharLength (const char *str)
| Returns the length in byte for the previous UTF8 character.
static const char * | NextChar (const char *str)
| Returns the char* pointer over the next UTF8 character.
static const char * | PrevChar (const char *str)
| Move the char* pointer before the previous UTF8 character.
static size_t | Length (const char *str)
| Returns the UTF8 length of a valid UTF8 std::string.
static const char * | FindNextInline (const char *str, const char ch)
| Finds a character in the same line. More...
static bool | IsLineEndingOrFileEnding (const char ch)
| Returns ture if the character is a line ending or end of file.
static std::string | FromSubstr (const char *str, size_t length)
| Copies a substd::string with given length to a new std::string.
static bool | NotShorterThan (const char *str, size_t byteLength)
| Returns true if the given std::string is longer or as long as the given length.
static std::string | TruncateUTF8 (const char *str, size_t maxByteLength)
| Truncates a std::string with a maximal length in byte. More...
static void | ReplaceAll (std::string &str, const char *from, const char *to)
| Replaces all patterns in a std::string in place.
static std::string | Join (const std::vector< std::string > &strings, const std::string &separator)
| Joins a std::string vector in to a std::string with a separator.
static std::string | Join (const std::vector< std::string > &strings)
| Joins a std::string vector in to a std::string.
static void | GetByteMap (const char *str, const size_t utf8Length, std::vector< size_t > *byteMap)
static std::string | GetPlatformString (const std::string &str)

## Detailed Description

UTF8 std::string utilities.

## Member Function Documentation

## ◆ FindNextInline()

static const char * opencc::UTF8Util::FindNextInline | ( | const char * | str,
|  | const char | ch
| ) |  |
| inlinestatic

Finds a character in the same line.

Parameters

  str | The text to be searched in.
  ch | The character to find.

Returns
  The pointer that points to the found chacter in str or EOL/EOF.

## ◆ NextCharLengthNoException()

static size_t opencc::UTF8Util::NextCharLengthNoException | ( | const char * | str | ) |
| inlinestatic

Returns the length in byte for the next UTF8 character.

On error returns 0.

## ◆ TruncateUTF8()

static std::string opencc::UTF8Util::TruncateUTF8 | ( | const char * | str,
|  | size_t | maxByteLength
| ) |  |
| inlinestatic

Truncates a std::string with a maximal length in byte.

No UTF8 character will be broken.

The documentation for this class was generated from the following files:

- UTF8Util.hpp
- UTF8Util.cpp