cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ccUTF8.h File Reference
#include "platform/CCPlatformMacros.h"
#include <vector>
#include <string>

Namespaces

 cocos2d
 Add deprecated global functions and variables here.
 
 cocos2d::StringUtils
 

Functions

CC_DLL bool UTF8ToUTF16 (const std::string &utf8, std::u16string &outUtf16)
 Converts utf8 string to utf16 string. More...
 
CC_DLL bool UTF16ToUTF8 (const std::u16string &utf16, std::string &outUtf8)
 Converts utf16 string to utf8 string. More...
 
CC_DLL void trimUTF16Vector (std::vector< char16_t > &str)
 Trims the unicode spaces at the end of char16_t vector. More...
 
CC_DLL bool isUnicodeSpace (char16_t ch)
 Whether the character is a whitespace character. More...
 
CC_DLL bool isCJKUnicode (char16_t ch)
 Whether the character is a Chinese/Japanese/Korean character. More...
 
CC_DLL long getCharacterCountInUTF8String (const std::string &utf8)
 Returns the length of the string in characters. More...
 
CC_DLL unsigned int getIndexOfLastNotChar16 (const std::vector< char16_t > &str, char16_t c)
 Gets the index of the last character that is not equal to the character given. More...
 
CC_DLL std::vector< char16_t > getChar16VectorFromUTF16String (const std::u16string &utf16)
 Gets char16_t vector from a given utf16 string. More...
 
CC_DLL int cc_wcslen (const unsigned short *str)
 Returns the character count in UTF16 string. More...
 
CC_DLL void cc_utf8_trim_ws (std::vector< unsigned short > *str)
 Trims the space characters at the end of UTF8 string. More...
 
CC_DLL bool isspace_unicode (unsigned short ch)
 Whether the character is a whitespace character. More...
 
CC_DLL bool iscjk_unicode (unsigned short ch)
 Whether the character is a Chinese/Japanese/Korean character. More...
 
CC_DLL long cc_utf8_strlen (const char *p, int max=-1)
 Returns the length of the string in characters. More...
 
CC_DLL unsigned int cc_utf8_find_last_not_char (const std::vector< unsigned short > &str, unsigned short c)
 Find the last character that is not equal to the character given. More...
 
CC_DLL std::vector< unsigned
short > 
cc_utf16_vec_from_utf16_str (const unsigned short *str)
 Gets unsigned short vector from a given utf16 string. More...
 
CC_DLL unsigned short * cc_utf8_to_utf16 (const char *str_old, int length=-1, int *rUtf16Size=nullptr)
 Creates an utf8 string from a c string. More...
 
CC_DLL char * cc_utf16_to_utf8 (const unsigned short *str, int len=-1, long *items_read=nullptr, long *items_written=nullptr)
 Converts a string from UTF-16 to UTF-8. More...