|
Open Chinese Convert 1.1.8
A project for conversion between Traditional and Simplified Chinese
|
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. | |
| 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. | |
| static bool | IsLineEndingOrFileEnding (const char ch) |
| Returns true if the character is a line ending or end of file. | |
| static std::string | FromSubstr (const char *str, size_t length) |
| Copies a substring with given length to a new 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. | |
| 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) |
UTF8 std::string utilities.
|
inlinestatic |
Finds a character in the same line.
| str | The text to be searched in. |
| ch | The character to find. |
|
inlinestatic |
Returns the length in byte for the next UTF8 character.
On error returns 0.
|
inlinestatic |
Truncates a std::string with a maximal length in byte.
No UTF8 character will be broken.