44 int length()
const {
return size() ? size()-1 : 0; }
46 operator const char*() {
return get_data();};
49 #ifndef CHARTYPE_16BITS 50 typedef wchar_t CharType;
52 typedef wchar_t uint16_t;
57 const CharType *c_str;
60 StrRange(
const CharType *p_c_str=NULL,
int p_len=0) { c_str=p_c_str; len=p_len; }
66 void copy_from(
const char *p_cstr);
67 void copy_from(
const CharType* p_cstr,
int p_clip_to=-1);
68 void copy_from(
const CharType& p_char);
79 bool operator==(
const String& p_str)
const;
80 bool operator!=(
const String& p_str)
const;
85 String& operator+=(CharType p_str);
86 String& operator+=(
const char * p_str);
87 String& operator+=(
const CharType * p_str);
92 void operator=(
const char *p_str);
93 void operator=(
const CharType *p_str);
94 bool operator==(
const char *p_str)
const;
95 bool operator==(
const CharType *p_str)
const;
96 bool operator==(
const StrRange &p_str_range)
const;
97 bool operator!=(
const char *p_str)
const;
98 bool operator!=(
const CharType *p_str)
const;
99 bool operator<(
const CharType *p_str)
const;
100 bool operator<(
const char *p_str)
const;
101 bool operator<(
String p_str)
const;
102 bool operator<=(
String p_str)
const;
104 signed char casecmp_to(
const String& p_str)
const;
105 signed char nocasecmp_to(
const String& p_str)
const;
107 const CharType * c_str()
const;
113 String substr(
int p_from,
int p_chars)
const;
114 int find(
String p_str,
int p_from=0)
const;
115 int find_last(
String p_str)
const;
116 int findn(
String p_str,
int p_from=0)
const;
117 int rfind(
String p_str,
int p_from=-1)
const;
118 int rfindn(
String p_str,
int p_from=-1)
const;
119 int findmk(
const Vector<String>& p_keys,
int p_from=0,
int *r_key=NULL)
const;
120 bool match(
const String& p_wildcard)
const;
121 bool matchn(
const String& p_wildcard)
const;
122 bool begins_with(
const String& p_string)
const;
123 bool begins_with(
const char* p_string)
const;
124 bool ends_with(
const String& p_string)
const;
129 String pad_decimals(
int p_digits)
const;
130 String pad_zeros(
int p_digits)
const;
131 String lpad(
int min_length,
const String& character=
" ")
const;
132 String rpad(
int min_length,
const String& character=
" ")
const;
133 String sprintf(
const Array& values,
bool* error)
const;
134 static String num(
double p_num,
int p_decimals=-1);
135 static String num_scientific(
double p_num);
136 static String num_real(
double p_num);
137 static String num_int64(int64_t p_num,
int base=10,
bool capitalize_hex=
false);
138 static String chr(CharType p_char);
139 static String md5(
const uint8_t *p_md5);
140 bool is_numeric()
const;
141 double to_double()
const;
142 float to_float()
const;
143 int hex_to_int()
const;
146 int64_t to_int64()
const;
147 static int to_int(
const char* p_str,
int p_len=-1);
148 static double to_double(
const char* p_str);
149 static double to_double(
const CharType* p_str,
const CharType **r_end=NULL);
150 static int64_t to_int(
const CharType* p_str,
int p_len=-1);
151 String capitalize()
const;
152 String camelcase_to_underscore(
bool lowercase=
true)
const;
154 int get_slice_count(
String p_splitter)
const;
156 String get_slicec(CharType splitter,
int p_slice)
const;
165 static CharType char_uppercase(CharType p_char);
166 static CharType char_lowercase(CharType p_char);
170 String left(
int p_pos)
const;
171 String right(
int p_pos)
const;
172 String strip_edges(
bool left =
true,
bool right =
true)
const;
173 String strip_escapes()
const;
177 CharType ord_at(
int p_idx)
const;
179 void erase(
int p_pos,
int p_chars);
181 CharString ascii(
bool p_allow_extended=
false)
const;
183 bool parse_utf8(
const char* p_utf8,
int p_len=-1);
184 static String utf8(
const char* p_utf8,
int p_len=-1);
186 static uint32_t hash(
const CharType* p_str,
int p_len);
187 static uint32_t hash(
const CharType* p_str);
188 static uint32_t hash(
const char* p_cstr,
int p_len);
189 static uint32_t hash(
const char* p_cstr);
190 uint32_t hash()
const;
191 uint64_t hash64()
const;
195 inline bool empty()
const {
return length() == 0; }
198 bool is_abs_path()
const;
199 bool is_rel_path()
const;
200 bool is_resource_file()
const;
203 String get_base_dir()
const;
205 static String humanize_size(
size_t p_size);
206 String simplify_path()
const;
208 String xml_escape(
bool p_escape_quotes=
false)
const;
209 String xml_unescape()
const;
210 String http_escape()
const;
211 String http_unescape()
const;
213 String c_unescape()
const;
214 String json_escape()
const;
215 String world_wrap(
int p_chars_per_line)
const;
217 String percent_encode()
const;
218 String percent_decode()
const;
220 bool is_valid_identifier()
const;
221 bool is_valid_integer()
const;
222 bool is_valid_float()
const;
223 bool is_valid_html_color()
const;
224 bool is_valid_ip_address()
const;
231 String(
const char *p_str);
232 String(
const CharType *p_str,
int p_clip_to_len=-1);
239 bool operator==(
const char*p_chr,
const String& p_str);
241 String operator+(
const char*p_chr,
const String& p_str);
244 String itos(int64_t p_val);
245 String rtos(
double p_val);
246 String rtoss(
double p_val);
251 bool operator()(
const String& p_a,
const String& p_b)
const {
253 return p_a.nocasecmp_to(p_b)<0;
String()
Definition: ustring.h:230
const char * get_data() const
Definition: ustring.cpp:54
Definition: ustring.h:249