ustring.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /*************************************************************************/
  2. /* ustring.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef USTRING_GODOT_H
  31. #define USTRING_GODOT_H
  32. // Note: Renamed to avoid conflict with ICU header with the same name.
  33. #include "core/templates/cowdata.h"
  34. #include "core/templates/vector.h"
  35. #include "core/typedefs.h"
  36. #include "core/variant/array.h"
  37. /*************************************************************************/
  38. /* CharProxy */
  39. /*************************************************************************/
  40. template <class T>
  41. class CharProxy {
  42. friend class Char16String;
  43. friend class CharString;
  44. friend class String;
  45. const int _index;
  46. CowData<T> &_cowdata;
  47. static const T _null = 0;
  48. _FORCE_INLINE_ CharProxy(const int &p_index, CowData<T> &cowdata) :
  49. _index(p_index),
  50. _cowdata(cowdata) {}
  51. public:
  52. _FORCE_INLINE_ operator T() const {
  53. if (unlikely(_index == _cowdata.size())) {
  54. return _null;
  55. }
  56. return _cowdata.get(_index);
  57. }
  58. _FORCE_INLINE_ const T *operator&() const {
  59. return _cowdata.ptr() + _index;
  60. }
  61. _FORCE_INLINE_ void operator=(const T &other) const {
  62. _cowdata.set(_index, other);
  63. }
  64. _FORCE_INLINE_ void operator=(const CharProxy<T> &other) const {
  65. _cowdata.set(_index, other.operator T());
  66. }
  67. };
  68. /*************************************************************************/
  69. /* Char16String */
  70. /*************************************************************************/
  71. class Char16String {
  72. CowData<char16_t> _cowdata;
  73. static const char16_t _null;
  74. public:
  75. _FORCE_INLINE_ char16_t *ptrw() { return _cowdata.ptrw(); }
  76. _FORCE_INLINE_ const char16_t *ptr() const { return _cowdata.ptr(); }
  77. _FORCE_INLINE_ int size() const { return _cowdata.size(); }
  78. Error resize(int p_size) { return _cowdata.resize(p_size); }
  79. _FORCE_INLINE_ char16_t get(int p_index) const { return _cowdata.get(p_index); }
  80. _FORCE_INLINE_ void set(int p_index, const char16_t &p_elem) { _cowdata.set(p_index, p_elem); }
  81. _FORCE_INLINE_ const char16_t &operator[](int p_index) const {
  82. if (unlikely(p_index == _cowdata.size())) {
  83. return _null;
  84. }
  85. return _cowdata.get(p_index);
  86. }
  87. _FORCE_INLINE_ CharProxy<char16_t> operator[](int p_index) { return CharProxy<char16_t>(p_index, _cowdata); }
  88. _FORCE_INLINE_ Char16String() {}
  89. _FORCE_INLINE_ Char16String(const Char16String &p_str) { _cowdata._ref(p_str._cowdata); }
  90. _FORCE_INLINE_ Char16String &operator=(const Char16String &p_str) {
  91. _cowdata._ref(p_str._cowdata);
  92. return *this;
  93. }
  94. _FORCE_INLINE_ Char16String(const char16_t *p_cstr) { copy_from(p_cstr); }
  95. Char16String &operator=(const char16_t *p_cstr);
  96. bool operator<(const Char16String &p_right) const;
  97. Char16String &operator+=(char16_t p_char);
  98. int length() const { return size() ? size() - 1 : 0; }
  99. const char16_t *get_data() const;
  100. operator const char16_t *() const { return get_data(); };
  101. protected:
  102. void copy_from(const char16_t *p_cstr);
  103. };
  104. /*************************************************************************/
  105. /* CharString */
  106. /*************************************************************************/
  107. class CharString {
  108. CowData<char> _cowdata;
  109. static const char _null;
  110. public:
  111. _FORCE_INLINE_ char *ptrw() { return _cowdata.ptrw(); }
  112. _FORCE_INLINE_ const char *ptr() const { return _cowdata.ptr(); }
  113. _FORCE_INLINE_ int size() const { return _cowdata.size(); }
  114. Error resize(int p_size) { return _cowdata.resize(p_size); }
  115. _FORCE_INLINE_ char get(int p_index) const { return _cowdata.get(p_index); }
  116. _FORCE_INLINE_ void set(int p_index, const char &p_elem) { _cowdata.set(p_index, p_elem); }
  117. _FORCE_INLINE_ const char &operator[](int p_index) const {
  118. if (unlikely(p_index == _cowdata.size())) {
  119. return _null;
  120. }
  121. return _cowdata.get(p_index);
  122. }
  123. _FORCE_INLINE_ CharProxy<char> operator[](int p_index) { return CharProxy<char>(p_index, _cowdata); }
  124. _FORCE_INLINE_ CharString() {}
  125. _FORCE_INLINE_ CharString(const CharString &p_str) { _cowdata._ref(p_str._cowdata); }
  126. _FORCE_INLINE_ CharString &operator=(const CharString &p_str) {
  127. _cowdata._ref(p_str._cowdata);
  128. return *this;
  129. }
  130. _FORCE_INLINE_ CharString(const char *p_cstr) { copy_from(p_cstr); }
  131. CharString &operator=(const char *p_cstr);
  132. bool operator<(const CharString &p_right) const;
  133. CharString &operator+=(char p_char);
  134. int length() const { return size() ? size() - 1 : 0; }
  135. const char *get_data() const;
  136. operator const char *() const { return get_data(); };
  137. protected:
  138. void copy_from(const char *p_cstr);
  139. };
  140. /*************************************************************************/
  141. /* String */
  142. /*************************************************************************/
  143. struct StrRange {
  144. const char32_t *c_str;
  145. int len;
  146. StrRange(const char32_t *p_c_str = nullptr, int p_len = 0) {
  147. c_str = p_c_str;
  148. len = p_len;
  149. }
  150. };
  151. class String {
  152. CowData<char32_t> _cowdata;
  153. static const char32_t _null;
  154. void copy_from(const char *p_cstr);
  155. void copy_from(const char *p_cstr, const int p_clip_to);
  156. void copy_from(const wchar_t *p_cstr);
  157. void copy_from(const wchar_t *p_cstr, const int p_clip_to);
  158. void copy_from(const char32_t *p_cstr);
  159. void copy_from(const char32_t *p_cstr, const int p_clip_to);
  160. void copy_from(const char32_t &p_char);
  161. void copy_from_unchecked(const char32_t *p_char, const int p_length);
  162. bool _base_is_subsequence_of(const String &p_string, bool case_insensitive) const;
  163. int _count(const String &p_string, int p_from, int p_to, bool p_case_insensitive) const;
  164. public:
  165. enum {
  166. npos = -1 ///<for "some" compatibility with std::string (npos is a huge value in std::string)
  167. };
  168. _FORCE_INLINE_ char32_t *ptrw() { return _cowdata.ptrw(); }
  169. _FORCE_INLINE_ const char32_t *ptr() const { return _cowdata.ptr(); }
  170. void remove(int p_index) { _cowdata.remove(p_index); }
  171. _FORCE_INLINE_ void clear() { resize(0); }
  172. _FORCE_INLINE_ char32_t get(int p_index) const { return _cowdata.get(p_index); }
  173. _FORCE_INLINE_ void set(int p_index, const char32_t &p_elem) { _cowdata.set(p_index, p_elem); }
  174. _FORCE_INLINE_ int size() const { return _cowdata.size(); }
  175. Error resize(int p_size) { return _cowdata.resize(p_size); }
  176. _FORCE_INLINE_ const char32_t &operator[](int p_index) const {
  177. if (unlikely(p_index == _cowdata.size())) {
  178. return _null;
  179. }
  180. return _cowdata.get(p_index);
  181. }
  182. _FORCE_INLINE_ CharProxy<char32_t> operator[](int p_index) { return CharProxy<char32_t>(p_index, _cowdata); }
  183. bool operator==(const String &p_str) const;
  184. bool operator!=(const String &p_str) const;
  185. String operator+(const String &p_str) const;
  186. String &operator+=(const String &);
  187. String &operator+=(char32_t p_char);
  188. String &operator+=(const char *p_str);
  189. String &operator+=(const wchar_t *p_str);
  190. String &operator+=(const char32_t *p_str);
  191. /* Compatibility Operators */
  192. void operator=(const char *p_str);
  193. void operator=(const wchar_t *p_str);
  194. void operator=(const char32_t *p_str);
  195. bool operator==(const char *p_str) const;
  196. bool operator==(const wchar_t *p_str) const;
  197. bool operator==(const char32_t *p_str) const;
  198. bool operator==(const StrRange &p_str_range) const;
  199. bool operator!=(const char *p_str) const;
  200. bool operator!=(const wchar_t *p_str) const;
  201. bool operator!=(const char32_t *p_str) const;
  202. bool operator<(const char32_t *p_str) const;
  203. bool operator<(const char *p_str) const;
  204. bool operator<(const wchar_t *p_str) const;
  205. bool operator<(const String &p_str) const;
  206. bool operator<=(const String &p_str) const;
  207. bool operator>(const String &p_str) const;
  208. bool operator>=(const String &p_str) const;
  209. signed char casecmp_to(const String &p_str) const;
  210. signed char nocasecmp_to(const String &p_str) const;
  211. signed char naturalnocasecmp_to(const String &p_str) const;
  212. const char32_t *get_data() const;
  213. /* standard size stuff */
  214. _FORCE_INLINE_ int length() const {
  215. int s = size();
  216. return s ? (s - 1) : 0; // length does not include zero
  217. }
  218. bool is_valid_string() const;
  219. /* complex helpers */
  220. String substr(int p_from, int p_chars = -1) const;
  221. int find(const String &p_str, int p_from = 0) const; ///< return <0 if failed
  222. int find(const char *p_str, int p_from = 0) const; ///< return <0 if failed
  223. int find_char(const char32_t &p_char, int p_from = 0) const; ///< return <0 if failed
  224. int findn(const String &p_str, int p_from = 0) const; ///< return <0 if failed, case insensitive
  225. int rfind(const String &p_str, int p_from = -1) const; ///< return <0 if failed
  226. int rfindn(const String &p_str, int p_from = -1) const; ///< return <0 if failed, case insensitive
  227. int findmk(const Vector<String> &p_keys, int p_from = 0, int *r_key = nullptr) const; ///< return <0 if failed
  228. bool match(const String &p_wildcard) const;
  229. bool matchn(const String &p_wildcard) const;
  230. bool begins_with(const String &p_string) const;
  231. bool begins_with(const char *p_string) const;
  232. bool ends_with(const String &p_string) const;
  233. bool is_enclosed_in(const String &p_string) const;
  234. bool is_subsequence_of(const String &p_string) const;
  235. bool is_subsequence_ofi(const String &p_string) const;
  236. bool is_quoted() const;
  237. Vector<String> bigrams() const;
  238. float similarity(const String &p_string) const;
  239. String format(const Variant &values, String placeholder = "{_}") const;
  240. String replace_first(const String &p_key, const String &p_with) const;
  241. String replace(const String &p_key, const String &p_with) const;
  242. String replace(const char *p_key, const char *p_with) const;
  243. String replacen(const String &p_key, const String &p_with) const;
  244. String repeat(int p_count) const;
  245. String insert(int p_at_pos, const String &p_string) const;
  246. String pad_decimals(int p_digits) const;
  247. String pad_zeros(int p_digits) const;
  248. String trim_prefix(const String &p_prefix) const;
  249. String trim_suffix(const String &p_suffix) const;
  250. String lpad(int min_length, const String &character = " ") const;
  251. String rpad(int min_length, const String &character = " ") const;
  252. String sprintf(const Array &values, bool *error) const;
  253. String quote(String quotechar = "\"") const;
  254. String unquote() const;
  255. static String num(double p_num, int p_decimals = -1);
  256. static String num_scientific(double p_num);
  257. static String num_real(double p_num);
  258. static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
  259. static String num_uint64(uint64_t p_num, int base = 10, bool capitalize_hex = false);
  260. static String chr(char32_t p_char);
  261. static String md5(const uint8_t *p_md5);
  262. static String hex_encode_buffer(const uint8_t *p_buffer, int p_len);
  263. bool is_numeric() const;
  264. double to_float() const;
  265. int64_t hex_to_int(bool p_with_prefix = true) const;
  266. int64_t bin_to_int(bool p_with_prefix = true) const;
  267. int64_t to_int() const;
  268. static int64_t to_int(const char *p_str, int p_len = -1);
  269. static int64_t to_int(const wchar_t *p_str, int p_len = -1);
  270. static int64_t to_int(const char32_t *p_str, int p_len = -1, bool p_clamp = false);
  271. static double to_float(const char *p_str);
  272. static double to_float(const wchar_t *p_str, const wchar_t **r_end = nullptr);
  273. static double to_float(const char32_t *p_str, const char32_t **r_end = nullptr);
  274. String capitalize() const;
  275. String camelcase_to_underscore(bool lowercase = true) const;
  276. String get_with_code_lines() const;
  277. int get_slice_count(String p_splitter) const;
  278. String get_slice(String p_splitter, int p_slice) const;
  279. String get_slicec(char32_t p_splitter, int p_slice) const;
  280. Vector<String> split(const String &p_splitter, bool p_allow_empty = true, int p_maxsplit = 0) const;
  281. Vector<String> rsplit(const String &p_splitter, bool p_allow_empty = true, int p_maxsplit = 0) const;
  282. Vector<String> split_spaces() const;
  283. Vector<float> split_floats(const String &p_splitter, bool p_allow_empty = true) const;
  284. Vector<float> split_floats_mk(const Vector<String> &p_splitters, bool p_allow_empty = true) const;
  285. Vector<int> split_ints(const String &p_splitter, bool p_allow_empty = true) const;
  286. Vector<int> split_ints_mk(const Vector<String> &p_splitters, bool p_allow_empty = true) const;
  287. String join(Vector<String> parts) const;
  288. static char32_t char_uppercase(char32_t p_char);
  289. static char32_t char_lowercase(char32_t p_char);
  290. String to_upper() const;
  291. String to_lower() const;
  292. int count(const String &p_string, int p_from = 0, int p_to = 0) const;
  293. int countn(const String &p_string, int p_from = 0, int p_to = 0) const;
  294. String left(int p_pos) const;
  295. String right(int p_pos) const;
  296. String dedent() const;
  297. String strip_edges(bool left = true, bool right = true) const;
  298. String strip_escapes() const;
  299. String lstrip(const String &p_chars) const;
  300. String rstrip(const String &p_chars) const;
  301. String get_extension() const;
  302. String get_basename() const;
  303. String plus_file(const String &p_file) const;
  304. char32_t ord_at(int p_idx) const;
  305. void erase(int p_pos, int p_chars);
  306. CharString ascii(bool p_allow_extended = false) const;
  307. CharString utf8() const;
  308. bool parse_utf8(const char *p_utf8, int p_len = -1); //return true on error
  309. static String utf8(const char *p_utf8, int p_len = -1);
  310. Char16String utf16() const;
  311. bool parse_utf16(const char16_t *p_utf16, int p_len = -1); //return true on error
  312. static String utf16(const char16_t *p_utf16, int p_len = -1);
  313. static uint32_t hash(const char32_t *p_cstr, int p_len); /* hash the string */
  314. static uint32_t hash(const char32_t *p_cstr); /* hash the string */
  315. static uint32_t hash(const wchar_t *p_cstr, int p_len); /* hash the string */
  316. static uint32_t hash(const wchar_t *p_cstr); /* hash the string */
  317. static uint32_t hash(const char *p_cstr, int p_len); /* hash the string */
  318. static uint32_t hash(const char *p_cstr); /* hash the string */
  319. uint32_t hash() const; /* hash the string */
  320. uint64_t hash64() const; /* hash the string */
  321. String md5_text() const;
  322. String sha1_text() const;
  323. String sha256_text() const;
  324. Vector<uint8_t> md5_buffer() const;
  325. Vector<uint8_t> sha1_buffer() const;
  326. Vector<uint8_t> sha256_buffer() const;
  327. _FORCE_INLINE_ bool empty() const { return length() == 0; }
  328. // path functions
  329. bool is_abs_path() const;
  330. bool is_rel_path() const;
  331. bool is_resource_file() const;
  332. String path_to(const String &p_path) const;
  333. String path_to_file(const String &p_path) const;
  334. String get_base_dir() const;
  335. String get_file() const;
  336. static String humanize_size(uint64_t p_size);
  337. String simplify_path() const;
  338. String xml_escape(bool p_escape_quotes = false) const;
  339. String xml_unescape() const;
  340. String http_escape() const;
  341. String http_unescape() const;
  342. String c_escape() const;
  343. String c_escape_multiline() const;
  344. String c_unescape() const;
  345. String json_escape() const;
  346. String word_wrap(int p_chars_per_line) const;
  347. String percent_encode() const;
  348. String percent_decode() const;
  349. String property_name_encode() const;
  350. bool is_valid_identifier() const;
  351. bool is_valid_integer() const;
  352. bool is_valid_float() const;
  353. bool is_valid_hex_number(bool p_with_prefix) const;
  354. bool is_valid_html_color() const;
  355. bool is_valid_ip_address() const;
  356. bool is_valid_filename() const;
  357. /**
  358. * The constructors must not depend on other overloads
  359. */
  360. _FORCE_INLINE_ String() {}
  361. _FORCE_INLINE_ String(const String &p_str) { _cowdata._ref(p_str._cowdata); }
  362. String &operator=(const String &p_str) {
  363. _cowdata._ref(p_str._cowdata);
  364. return *this;
  365. }
  366. Vector<uint8_t> to_ascii_buffer() const;
  367. Vector<uint8_t> to_utf8_buffer() const;
  368. Vector<uint8_t> to_utf16_buffer() const;
  369. Vector<uint8_t> to_utf32_buffer() const;
  370. String(const char *p_str);
  371. String(const wchar_t *p_str);
  372. String(const char32_t *p_str);
  373. String(const char *p_str, int p_clip_to_len);
  374. String(const wchar_t *p_str, int p_clip_to_len);
  375. String(const char32_t *p_str, int p_clip_to_len);
  376. String(const StrRange &p_range);
  377. };
  378. bool operator==(const char *p_chr, const String &p_str);
  379. bool operator==(const wchar_t *p_chr, const String &p_str);
  380. bool operator!=(const char *p_chr, const String &p_str);
  381. bool operator!=(const wchar_t *p_chr, const String &p_str);
  382. String operator+(const char *p_chr, const String &p_str);
  383. String operator+(const wchar_t *p_chr, const String &p_str);
  384. String operator+(char32_t p_chr, const String &p_str);
  385. String itos(int64_t p_val);
  386. String uitos(uint64_t p_val);
  387. String rtos(double p_val);
  388. String rtoss(double p_val); //scientific version
  389. struct NoCaseComparator {
  390. bool operator()(const String &p_a, const String &p_b) const {
  391. return p_a.nocasecmp_to(p_b) < 0;
  392. }
  393. };
  394. struct NaturalNoCaseComparator {
  395. bool operator()(const String &p_a, const String &p_b) const {
  396. return p_a.naturalnocasecmp_to(p_b) < 0;
  397. }
  398. };
  399. template <typename L, typename R>
  400. _FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) {
  401. while (true) {
  402. const char32_t l = *l_ptr;
  403. const char32_t r = *r_ptr;
  404. if (l == 0 && r == 0) {
  405. return false;
  406. } else if (l == 0) {
  407. return true;
  408. } else if (r == 0) {
  409. return false;
  410. } else if (l < r) {
  411. return true;
  412. } else if (l > r) {
  413. return false;
  414. }
  415. l_ptr++;
  416. r_ptr++;
  417. }
  418. }
  419. /* end of namespace */
  420. // Tool translate (TTR and variants) for the editor UI,
  421. // and doc translate for the class reference (DTR).
  422. #ifdef TOOLS_ENABLED
  423. // Gets parsed.
  424. String TTR(const String &p_text, const String &p_context = "");
  425. String TTRN(const String &p_text, const String &p_text_plural, int p_n, const String &p_context = "");
  426. String DTR(const String &p_text, const String &p_context = "");
  427. String DTRN(const String &p_text, const String &p_text_plural, int p_n, const String &p_context = "");
  428. // Use for C strings.
  429. #define TTRC(m_value) (m_value)
  430. // Use to avoid parsing (for use later with C strings).
  431. #define TTRGET(m_value) TTR(m_value)
  432. #else
  433. #define TTR(m_value) (String())
  434. #define TTRN(m_value) (String())
  435. #define DTR(m_value) (String())
  436. #define DTRN(m_value) (String())
  437. #define TTRC(m_value) (m_value)
  438. #define TTRGET(m_value) (m_value)
  439. #endif
  440. // Runtime translate for the public node API.
  441. String RTR(const String &p_text, const String &p_context = "");
  442. String RTRN(const String &p_text, const String &p_text_plural, int p_n, const String &p_context = "");
  443. bool is_symbol(char32_t c);
  444. bool select_word(const String &p_s, int p_col, int &r_beg, int &r_end);
  445. _FORCE_INLINE_ void sarray_add_str(Vector<String> &arr) {
  446. }
  447. _FORCE_INLINE_ void sarray_add_str(Vector<String> &arr, const String &p_str) {
  448. arr.push_back(p_str);
  449. }
  450. template <class... P>
  451. _FORCE_INLINE_ void sarray_add_str(Vector<String> &arr, const String &p_str, P... p_args) {
  452. arr.push_back(p_str);
  453. sarray_add_str(arr, p_args...);
  454. }
  455. template <class... P>
  456. _FORCE_INLINE_ Vector<String> sarray(P... p_args) {
  457. Vector<String> arr;
  458. sarray_add_str(arr, p_args...);
  459. return arr;
  460. }
  461. #endif // USTRING_GODOT_H