32 #include "../api_core.h"
35 #ifdef __cplusplus_cli
36 #pragma managed(push, on)
52 static std::vector<std::string> split_text(
53 const std::string &text,
54 const std::string &split_string,
55 bool skip_empty =
true);
61 static std::string wchar_to_utf8(
wchar_t value);
67 static std::string unicode_to_utf8(
unsigned int value);
74 static std::string trim(
const std::string &text);
83 static int compare(
const std::string &a,
const std::string &b,
bool case_insensitive =
false);
92 static int compare(
const std::wstring &a,
const std::wstring &b,
bool case_insensitive =
false);
99 static std::string text_to_upper(
const std::string &s);
106 static std::string local8_to_upper(
const std::string &s);
113 static std::wstring ucs2_to_upper(
const std::wstring &s);
120 static std::string text_to_lower(
const std::string &s);
127 static std::string local8_to_lower(
const std::string &s);
134 static std::wstring ucs2_to_lower(
const std::wstring &s);
142 static std::string float_to_text(
float value,
int num_decimal_places=6);
150 static std::string float_to_local8(
float value,
int num_decimal_places=6);
158 static std::wstring float_to_ucs2(
float value,
int num_decimal_places=6);
165 static float text_to_float(
const std::string &value);
172 static float local8_to_float(
const std::string &value);
179 static float ucs2_to_float(
const std::wstring &value);
187 static std::string double_to_text(
double value,
int num_decimal_places=6);
195 static std::string double_to_local8(
double value,
int num_decimal_places=6);
203 static std::wstring double_to_ucs2(
double value,
int num_decimal_places=6);
210 static double text_to_double(
const std::string &value);
217 static double local8_to_double(
const std::string &value);
224 static double ucs2_to_double(
const std::wstring &value);
231 static std::string int_to_text(
int value);
238 static std::string int_to_local8(
int value);
245 static std::wstring int_to_ucs2(
int value);
253 static int text_to_int(
const std::string &value,
int base = 10);
261 static int local8_to_int(
const std::string &value,
int base = 10);
269 static int ucs2_to_int(
const std::wstring &value,
int base = 10);
276 static std::string uint_to_text(
unsigned int value);
283 static std::string uint_to_local8(
unsigned int value);
290 static std::wstring uint_to_ucs2(
unsigned int value);
292 static unsigned int text_to_uint(
const std::string &value,
int base = 10);
294 static unsigned int local8_to_uint(
const std::string &value,
int base = 10);
296 static unsigned int ucs2_to_uint(
const std::wstring &value,
int base = 10);
303 static std::string ll_to_text(
long long value);
310 static std::string ll_to_local8(
long long value);
317 static std::wstring ll_to_ucs2(
long long value);
325 static long long text_to_ll(
const std::string &value,
int base = 10);
333 static long long local8_to_ll(
const std::string &value,
int base = 10);
341 static long long ucs2_to_ll(
const std::wstring &value,
int base = 10);
348 static std::string ull_to_text(
unsigned long long value);
355 static std::string ull_to_local8(
unsigned long long value);
362 static std::wstring ull_to_ucs2(
unsigned long long value);
370 static unsigned long long text_to_ull(
const std::string &value,
int base = 10);
378 static unsigned long long local8_to_ull(
const std::string &value,
int base = 10);
386 static unsigned long long ucs2_to_ull(
const std::wstring &value,
int base = 10);
393 static std::string bool_to_text(
bool value);
400 static std::string bool_to_local8(
bool value);
407 static std::wstring bool_to_ucs2(
bool value);
414 static bool text_to_bool(
const std::string &value);
421 static bool local8_to_bool(
const std::string &value);
428 static bool ucs2_to_bool(
const std::wstring &value);
435 static std::string text_to_cp437(
const std::string &text);
442 static std::string ucs2_to_cp437(
const std::wstring &text);
449 static std::string cp437_to_text(
const std::string &cp437);
456 static std::wstring cp437_to_ucs2(
const std::string &cp437);
463 static std::string text_to_local8(
const std::string &text);
470 static std::string text_to_utf8(
const std::string &text);
477 static std::string ucs2_to_latin1(
const std::wstring &ucs2);
484 static std::string ucs2_to_latin9(
const std::wstring &ucs2);
491 static std::string ucs2_to_local8(
const std::wstring &ucs2);
498 static std::string ucs2_to_utf8(
const std::wstring &ucs2);
505 static std::string local8_to_text(
const std::string &local8);
512 static std::string ucs2_to_text(
const std::wstring &ucs2);
519 static std::wstring latin1_to_ucs2(
const std::string &latin1);
526 static std::wstring latin9_to_ucs2(
const std::string &latin9);
533 static std::wstring local8_to_ucs2(
const std::string &local8);
540 static std::wstring utf8_to_ucs2(
const std::string &utf8);
547 static std::string utf8_to_text(
const std::string &utf8);
549 static std::string::size_type utf8_length(
const std::string &str);
567 static BOMType detect_bom(
const void *data, std::string::size_type length);
569 #ifdef __cplusplus_cli
570 static std::string clr_to_text(
const System::String ^str)
577 return ucs2_to_utf8(clr_to_ucs2(str));
580 static System::String ^text_to_clr(
const std::string &str)
582 return ucs2_to_clr(utf8_to_ucs2(str));
590 static std::wstring clr_to_ucs2(
const System::String ^str)
592 cli::pin_ptr<const wchar_t> chars = PtrToStringChars(str);
593 return std::wstring(chars);
596 static System::String ^ucs2_to_clr(
const std::wstring &str)
598 return gcnew System::String(str.c_str());
607 static const char trailing_bytes_for_utf8[256];
609 static const unsigned char bitmask_leadbyte_for_utf8[6];
615 #ifdef __cplusplus_cli
String helper functions.
Definition: string_help.h:46
Definition: string_help.h:554
Definition: string_help.h:553
BOMType
Definition: string_help.h:551
Definition: string_help.h:557
Definition: string_help.h:555
Definition: string_help.h:556