Skylicht Engine
Loading...
Searching...
No Matches
CStringImp.h
1/*
2!@
3MIT License
4
5Copyright (c) 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include <stdio.h>
28#include <string.h>
29#include <stdlib.h>
30#include <cwchar>
31#include <cwctype>
32#include <cstdarg>
33#include <string>
34#include <vector>
35
36namespace Skylicht
37{
47 class SKYLICHT_API CStringImp
48 {
49 public:
56 template <class T>
57 static int length(T* pString)
58 {
59 int result = 0;
60 while (pString[result] != 0)
61 result++;
62
63 return result;
64 }
65
74 template <class T>
75 static int find(T* pString, T pCharSearch, int begin = 0)
76 {
77 int index = begin;
78
79 while (pString[index] != 0)
80 {
81 if (pString[index] == pCharSearch)
82 return index;
83
84 index++;
85 }
86
87 return -1;
88 }
89
98 template <class T>
99 static int find(T* pString, T* pKeySearch, int begin = 0)
100 {
101 int size = CStringImp::length<T>(pKeySearch) * sizeof(T);
102 int index = begin;
103
104 while (pString[index] != 0)
105 {
106 if (memcmp(&pString[index], pKeySearch, size) == 0)
107 return index;
108
109 index++;
110 }
111
112 return -1;
113 }
114
120 template <class T>
121 static void trimleft(T* pString)
122 {
123 int len = CStringImp::length<T>(pString);
124 if (len == 0)
125 return;
126
127 while (pString[0] != 0 && (pString[0] == ' ' || pString[0] == '\r' || pString[0] == '\n' || pString[0] == '\t'))
128 {
129 len--;
130 if (len == 0)
131 return;
132
133 memmove((void*)&pString[0], (void*)&pString[1], len * sizeof(T));
134 pString[len] = 0;
135 }
136 }
137
143 template <class T>
144 static void trimright(T* pString)
145 {
146 int len = CStringImp::length<T>(pString);
147 len--;
148
149 for (; len >= 0; len--)
150 {
151 if (pString[len] == ' ' || pString[len] == '\r' || pString[len] == '\n' || pString[len] == '\t')
152 pString[len] = 0;
153 else
154 return;
155 }
156 }
157
164 template <class T>
165 static void trimleft(T* pString, T delChar)
166 {
167 int len = CStringImp::length<T>(pString);
168 if (len == 0)
169 return;
170
171 while (pString[0] != 0 && pString[0] == delChar)
172 {
173 len--;
174 if (len == 0)
175 return;
176
177 memmove((void*)&pString[0], (void*)&pString[1], len * sizeof(T));
178 pString[len] = 0;
179 }
180 }
181
188 template <class T>
189 static void trimright(T* pString, T delChar)
190 {
191 int len = CStringImp::length<T>(pString);
192 len--;
193
194 for (; len >= 0; len--)
195 {
196 if (pString[len] == delChar)
197 pString[len] = 0;
198 else
199 return;
200 }
201 }
202
208 template <class T>
209 static void trim(T* pString)
210 {
213 }
214
221 template <class T>
222 static void trim(T* pString, T delChar)
223 {
224 CStringImp::trimleft<T>(pString, delChar);
225 CStringImp::trimright<T>(pString, delChar);
226 }
227
236 template <class T>
237 static int countEntry(T* pString, T entry, int begin = 0)
238 {
239 int index = begin;
240 int result = 0;
241
242 while (pString[index] != 0)
243 {
244 if (pString[index] == entry)
245 result++;
246
247 index++;
248 }
249
250 return result;
251 }
252
261 template <class T1, class T2>
262 static int copy(T1* pStringDst, T2* pStringSrc)
263 {
264 if (pStringSrc == 0)
265 {
266 pStringDst[0] = 0;
267 return 0;
268 }
269
270 int index = 0;
271
272 while (pStringSrc[index] != 0)
273 {
274 pStringDst[index] = (T1)(pStringSrc[index]);
275 index++;
276 }
277 pStringDst[index] = 0;
278 return index;
279 }
280
285 template <class T1, class T2>
286 static int copyAt(T1* pStringDst, T2* pStringSrc, int at)
287 {
288 int index = at;
289 int i = 0;
290
291 if (pStringSrc == 0)
292 return 0;
293
294 if (length(pStringDst) < at || at < 0)
295 return 0;
296
297 while (pStringSrc[i] != 0)
298 {
299 pStringDst[index] = (T1)(pStringSrc[i]);
300 index++; i++;
301 }
302 pStringDst[index] = 0;
303 return index;
304 }
305
310 template <class T1, class T2>
311 static int cat(T1* pStringDst, T2* pStringSrc)
312 {
313 int index = CStringImp::length<T1>(pStringDst);
314 int i = 0;
315
316 if (pStringSrc == 0)
317 return index;
318
319 while (pStringSrc[i] != 0)
320 {
321 pStringDst[index] = (T1)(pStringSrc[i]);
322 index++; i++;
323 }
324 pStringDst[index] = 0;
325 return i;
326 }
327
332 template <class T>
333 static int comp(T* pString1, T* pString2)
334 {
335 int len1 = (int)(CStringImp::length<T>(pString1) * sizeof(T));
336 int len2 = (int)(CStringImp::length<T>(pString2) * sizeof(T));
337 int len = len1 < len2 ? len1 : len2;
338
339 int r = memcmp(pString1, pString2, len);
340
341 if (r == 0)
342 {
343 if (len1 == len2)
344 return 0;
345 if (len1 > len2)
346 return 1;
347 if (len1 < len2)
348 return -1;
349 }
350
351 return r;
352 }
353
358 template <class T>
359 static int comp(T* pString1, T* pString2, int len)
360 {
361 return memcmp(pString1, pString2, len * sizeof(T));
362 }
363
372 template <class T1, class T2>
373 static int mid(T1* pStringDst, T2* pStringSrc, int begin, int end)
374 {
375 int index, i = 0;
376 for (index = begin; index < end; index++)
377 {
378 pStringDst[i] = (T1)pStringSrc[index];
379 i++;
380 }
381
382 pStringDst[i] = 0;
383
384 return i;
385 }
386
391 template <class T1, class T2>
392 static int getBlock(T1* pStringDst, T2* pStringSrc, T2* pBlock, int begin = 0)
393 {
394 int dwBegin = CStringImp::find<T2>(pStringSrc, *pBlock, begin);
395 if (dwBegin == -1)
396 return -1;
397
398 dwBegin++;
399 int dwEnd = CStringImp::find<T2>(pStringSrc, *pBlock, dwBegin);
400 if (dwEnd == -1)
401 return -1;
402
403 CStringImp::mid<T1, T2>(pStringDst, pStringSrc, dwBegin, dwEnd);
404 return dwEnd + 1;
405 }
406
411 template <class T1, class T2>
412 static int findBlock(T1* pStringDst, T2* pStringSrc, T2* pBlock, int begin = 0)
413 {
414 int i = begin;
415 int block = 0;
416 int midBegin = -1;
417
418 if (length(pBlock) != 2)
419 return -1;
420
421 while (pStringSrc[i] != 0)
422 {
423 if (pStringSrc[i] == pBlock[0]) // '{' or '[' or '('
424 {
425 block++;
426 if (block == 1)
427 midBegin = i + 1;
428 i++;
429 continue;
430 }
431 if (pStringSrc[i] == pBlock[1]) // '}' or ']' or ')'
432 {
433 block--;
434 if (block == 0 && midBegin != -1)
435 {
436 CStringImp::mid<T1, T2>(pStringDst, pStringSrc, midBegin, i);
437 return i + 1;
438 }
439
440 // Error found '{' but can't find '}')
441 if (block <= 0)
442 return -1;
443 }
444 i++;
445 }
446 return -1;
447 }
448
453 template <class T1, class T2>
454 static int findBlockString(T1* pStringDst, T2* pStringSrc, T2* pBlock1, T2* pBlock2, int begin = 0)
455 {
456 int blockLen1 = CStringImp::length<T2>(pBlock1);
457 int blockLen2 = CStringImp::length<T2>(pBlock2);
458 int len = blockLen1 > blockLen2 ? blockLen1 : blockLen2;
459
460 int i = begin;
461 int block = 0;
462 int midBegin = -1;
463
464 while (pStringSrc[i + len - 1] != 0)
465 {
466 // '<begin>
467 if (CStringImp::comp<T2>(&pStringSrc[i], pBlock1, blockLen1) == 0)
468 {
469 block++;
470 if (block == 1)
471 midBegin = i + CStringImp::length<T2>(pBlock1);
472
473 i++;
474 continue;
475 }
476 // '</begin>'
477 if (CStringImp::comp<T2>(&pStringSrc[i], pBlock2, blockLen2) == 0)
478 {
479 block--;
480 if (block == 0 && midBegin != -1)
481 {
482 CStringImp::mid<T1, T2>(pStringDst, pStringSrc, midBegin, i);
483 return i + 1;
484 }
485 if (block <= 0)
486 return -1;
487 }
488 i++;
489 }
490
491 return -1;
492 }
493
499 template<class T>
500 static void inorgeLoopChar(T* pString, T charLoop)
501 {
502 int i = 0;
503 while (pString[i] != 0)
504 {
505 if (pString[i] == charLoop)
506 {
507 while (pString[i + 1] == charLoop && pString[i + 1] != 0)
508 {
509 int len = CStringImp::length<T>(&pString[i]);
510 memmove(&pString[i], &pString[i + 1], len);
511 }
512 }
513
514 i++;
515 }
516 }
517
526 template<class T>
527 static bool split(T* lpStrResult, const T* lpStringSearch, const T* lpStrSplit, int* pos)
528 {
529 int nLenSearch = CStringImp::length<const T>(lpStringSearch);
530 if (*pos >= nLenSearch)
531 return false;
532
533 int nLen = CStringImp::length<const T>(lpStrSplit);
534 if (nLen == 0)
535 return false;
536
537 int i;
538 int minPos = -1;
539
540 for (i = 0; i < nLen; i++)
541 {
542 int tempPos = *pos;
543
544 tempPos = CStringImp::find<const T>(lpStringSearch, lpStrSplit[i], tempPos);
545 if (tempPos == -1)
546 continue;
547
548 minPos = tempPos;
549 break;
550 }
551
552 if (minPos == -1)
553 {
554 CStringImp::mid<T, const T>(lpStrResult, lpStringSearch, *pos, nLenSearch);
555 *pos = nLenSearch;
556 return true;
557 }
558
559 for (; i < nLen; i++)
560 {
561 int tempPos = CStringImp::find<const T>(lpStringSearch, lpStrSplit[i], *pos);
562 if (tempPos == -1)
563 continue;
564
565 if (minPos > tempPos)
566 minPos = tempPos;
567 }
568
569 CStringImp::mid<T, const T>(lpStrResult, lpStringSearch, *pos, minPos);
570 *pos = minPos + 1;
571
572 return true;
573 }
574
582 static int splitString(const char* stringSplit, const char* search, std::vector<std::string>& result);
583
591 static std::string replaceAll(std::string& string, const std::string& from, const std::string& to);
592
600 static int splitString(const wchar_t* stringSplit, const wchar_t* search, std::vector<std::wstring>& result);
601
608 static bool format(char* lpString, const char* lpStringFormat, ...);
609
614 template<class T>
615 static bool parseToInt(T* lpString, int* result)
616 {
617 wchar_t lpAString[400];
618 CStringImp::copy<wchar_t, T>(lpAString, lpString);
619
620 if (swscanf(lpAString, L"%d", result) == -1)
621 return false;
622
623 return true;
624 }
625
630 template<class T>
631 static bool parseToFloat(T* lpString, float* result)
632 {
633 wchar_t lpAString[400];
634 CStringImp::copy<wchar_t, T>(lpAString, lpString);
635
636 if (swscanf(lpAString, L"%f", result) == -1)
637 return false;
638
639 return true;
640 }
641
646 template<class T>
647 static bool parseToUInt(T* lpString, int* result)
648 {
649 wchar_t lpAString[400];
650 CStringImp::copy<wchar_t, T>(lpAString, lpString);
651
652 if (swscanf(lpAString, L"%u", result) == -1)
653 return false;
654
655 return true;
656 }
657
662 template<class T>
663 static bool parseFromHex(T* lpString, int* result)
664 {
665 wchar_t lpAString[400];
666 CStringImp::copy<wchar_t, T>(lpAString, lpString);
667
668 if (swscanf(lpAString, L"%X", result) == -1)
669 return false;
670
671 return true;
672 }
673
677 template<class T>
678 static void toLower(T* lpString)
679 {
680 int i = 0;
681 while (lpString[i] != 0)
682 {
683 lpString[i] = (int)towlower(lpString[i]);
684 i++;
685 }
686 }
687
691 template<class T>
692 static void toUpper(T* lpString)
693 {
694 int i = 0;
695 while (lpString[i] != 0)
696 {
697 lpString[i] = (int)towupper(lpString[i]);
698 i++;
699 }
700 }
701
707 template<class T1, class T2>
708 static void getFolderPath(T1* dstString, T2* lpString)
709 {
710 int i = CStringImp::length<T2>(lpString) - 1;
711 while (i >= 0)
712 {
713 if (lpString[i] == '\\' || lpString[i] == '/')
714 break;
715 i--;
716 }
717 CStringImp::copy<T1, T2>(dstString, lpString);
718 if (i < 0)
719 i = 0;
720 dstString[i] = 0;
721 }
722
728 template<class T1, class T2>
729 static void getFileName(T1* dstString, T2* lpString)
730 {
731 int i = CStringImp::length<T2>(lpString) - 1;
732 while (i > 0)
733 {
734 if (lpString[i] == '\\' || lpString[i] == '/')
735 break;
736 i--;
737 }
738 if (i == 0)
739 CStringImp::copy<T1, T2>(dstString, lpString);
740 else
741 CStringImp::copy<T1, T2>(dstString, lpString + i + 1);
742 }
743
749 template<class T1, class T2>
750 static void getFileNameExt(T1* dstString, T2* lpString)
751 {
752 int i = CStringImp::length<T2>(lpString) - 1;
753 bool haveExt = false;
754
755 while (i > 0)
756 {
757 if (lpString[i] == '.')
758 {
759 haveExt = true;
760 break;
761 }
762
763 if (lpString[i] == '\\' || lpString[i] == '/')
764 {
765 break;
766 }
767 i--;
768 }
769
770 if (i == 0 || !haveExt)
772 else
773 CStringImp::copy<T1, T2>(dstString, lpString + i + 1);
774 }
775
781 template<class T1, class T2>
782 static void getFileNameNoExt(T1* dstString, T2* lpString)
783 {
784 int i = CStringImp::length<T2>(lpString) - 1;
785
786 int dotPos = -1;
787 while (i > 0)
788 {
789 if (lpString[i] == '.' && dotPos == -1)
790 dotPos = i;
791 else if (lpString[i] == '\\' || lpString[i] == '/')
792 break;
793 i--;
794 }
795
796 if (i == 0)
797 {
798 CStringImp::copy<T1, T2>(dstString, lpString);
799 if (dotPos != -1)
800 dstString[dotPos] = 0;
801 }
802 else
803 {
804 CStringImp::copy<T1, T2>(dstString, lpString + i + 1);
805 if (dotPos != -1)
806 dstString[dotPos - i - 1] = 0;
807 }
808 }
809
815 template<class T>
816 static void shortName(T* dest, const T* name, int maxchar)
817 {
818 int l = length<const T>(name);
819 if (l <= maxchar)
820 {
821 copy<T, const T>(dest, name);
822 return;
823 }
824
825 // copy
826 for (int i = 0; i < maxchar; i++)
827 dest[i] = name[i];
828
829 dest[maxchar] = 0;
830
831 if (maxchar - 1 > 0)
832 dest[maxchar - 1] = (T)'.';
833
834 if (maxchar - 2 > 0)
835 dest[maxchar - 2] = (T)'.';
836
837 //if (maxchar - 3 > 0)
838 // dest[maxchar - 3] = (T)'.';
839 }
840
848 template<class T>
849 static void replaceText(T* result, const T* string, const T* search, const T* replace)
850 {
851 int lenSearch = length<const T>(search);
852 int lenReplace = length<const T>(replace);
853 int lenString = length<const T>(string);
854
855 int j = 0;
856 result[j] = 0;
857
858 for (int i = 0, n = lenString; i < n; i++)
859 {
860 if (i <= lenString - lenSearch && memcmp(string + i, search, lenSearch * sizeof(T)) == 0)
861 {
862 cat<T, const T>(result + j, replace);
863
864 i += lenSearch;
865 i--; // for ++ next loop
866
867 j += lenReplace;
868 result[j] = 0;
869 }
870 else
871 {
872 result[j] = string[i];
873
874 j++;
875 result[j] = 0;
876 }
877 }
878 }
879
885 static wchar_t utf8Char2Unicode(const char*& str);
886
892 static unsigned short* getUnicodeString(const wchar_t* src);
893
899 static void convertUTF8ToUnicode(const char* src, wchar_t* dst);
900
906 static int getUnicodeStringSize(const char* src);
907
913 static void convertUnicodeToUTF8(const wchar_t* src, char* dst);
914
920 static int getUTF8StringSize(const wchar_t* src);
921
927 static void replaceExt(char* lpPath, const char* lpExt);
928
934 static void replacePathExt(char* lpPath, const char* lpExt);
935
942 static int findStringInList(std::vector<std::string>& listString, const char* find);
943
950 static void replaceString(std::string& subject, const std::string& search, const std::string& replace);
951
957 static const std::string& convertUnicodeToUTF8(const wchar_t* src);
958
964 static const std::wstring& convertUTF8ToUnicode(const char* src);
965
971 static const std::string& toLower(const std::string& s);
972
978 static const std::wstring& toLower(const std::wstring& s);
979
985 static const std::string& toUpper(const std::string& s);
986
992 static const std::wstring& toUpper(const std::wstring& s);
993
1001 static const std::string& formatThousand(int n, bool useK, bool useM);
1002 };
1003
1004}
Low-level string helper functions used by engine utilities.
Definition CStringImp.h:48
static void toLower(T *lpString)
Convert a mutable string to lowercase in place.
Definition CStringImp.h:678
static const std::string & toLower(const std::string &s)
Return a lowercase copy of a narrow string.
static const std::string & convertUnicodeToUTF8(const wchar_t *src)
Convert wide-character text to UTF-8 using shared temporary storage.
static int findBlockString(T1 *pStringDst, T2 *pStringSrc, T2 *pBlock1, T2 *pBlock2, int begin=0)
Extract text from a balanced block with string begin/end markers.
Definition CStringImp.h:454
static bool parseToInt(T *lpString, int *result)
Parse a signed integer from a string.
Definition CStringImp.h:615
static int getBlock(T1 *pStringDst, T2 *pStringSrc, T2 *pBlock, int begin=0)
Extract text between two occurrences of the same delimiter.
Definition CStringImp.h:392
static int findBlock(T1 *pStringDst, T2 *pStringSrc, T2 *pBlock, int begin=0)
Extract text from a balanced block such as {} or [].
Definition CStringImp.h:412
static void getFolderPath(T1 *dstString, T2 *lpString)
Extract the folder path from a file path.
Definition CStringImp.h:708
static void trimright(T *pString)
Remove trailing whitespace characters from a mutable string.
Definition CStringImp.h:144
static void getFileNameNoExt(T1 *dstString, T2 *lpString)
Extract the file name without extension from a path.
Definition CStringImp.h:782
static int getUnicodeStringSize(const char *src)
Calculate the wide-character length required for a UTF-8 string.
static const std::wstring & toLower(const std::wstring &s)
Return a lowercase copy of a wide string.
static void convertUTF8ToUnicode(const char *src, wchar_t *dst)
Convert UTF-8 text to a wide-character buffer.
static void trimleft(T *pString)
Remove leading whitespace characters from a mutable string.
Definition CStringImp.h:121
static int find(T *pString, T pCharSearch, int begin=0)
Find a character in a null-terminated string.
Definition CStringImp.h:75
static void trimright(T *pString, T delChar)
Remove trailing occurrences of a character.
Definition CStringImp.h:189
static int splitString(const wchar_t *stringSplit, const wchar_t *search, std::vector< std::wstring > &result)
Split a wide string into a vector.
static int comp(T *pString1, T *pString2)
Compare two null-terminated strings by raw character bytes.
Definition CStringImp.h:333
static const std::wstring & toUpper(const std::wstring &s)
Return an uppercase copy of a wide string.
static void toUpper(T *lpString)
Convert a mutable string to uppercase in place.
Definition CStringImp.h:692
static void replaceString(std::string &subject, const std::string &search, const std::string &replace)
Replace all occurrences of a substring in a std::string.
static void trimleft(T *pString, T delChar)
Remove leading occurrences of a character.
Definition CStringImp.h:165
static bool parseToUInt(T *lpString, int *result)
Parse an unsigned integer from a string.
Definition CStringImp.h:647
static void replaceText(T *result, const T *string, const T *search, const T *replace)
Replace all occurrences of text in a source buffer.
Definition CStringImp.h:849
static int findStringInList(std::vector< std::string > &listString, const char *find)
Find a string in a vector.
static int getUTF8StringSize(const wchar_t *src)
Calculate the UTF-8 byte length required for a wide string.
static int copy(T1 *pStringDst, T2 *pStringSrc)
Copy a null-terminated string while converting character type.
Definition CStringImp.h:262
static wchar_t utf8Char2Unicode(const char *&str)
Decode one UTF-8 character and advance the source pointer.
static int cat(T1 *pStringDst, T2 *pStringSrc)
Append a source string to a destination string.
Definition CStringImp.h:311
static bool split(T *lpStrResult, const T *lpStringSearch, const T *lpStrSplit, int *pos)
Split a string incrementally using any character from a delimiter set.
Definition CStringImp.h:527
static void trim(T *pString, T delChar)
Remove leading and trailing occurrences of a character.
Definition CStringImp.h:222
static const std::string & toUpper(const std::string &s)
Return an uppercase copy of a narrow string.
static bool format(char *lpString, const char *lpStringFormat,...)
Format text into a caller-provided buffer.
static void convertUnicodeToUTF8(const wchar_t *src, char *dst)
Convert wide-character text to UTF-8.
static bool parseToFloat(T *lpString, float *result)
Parse a floating-point value from a string.
Definition CStringImp.h:631
static int find(T *pString, T *pKeySearch, int begin=0)
Find a substring in a null-terminated string.
Definition CStringImp.h:99
static const std::string & formatThousand(int n, bool useK, bool useM)
Format a number with thousand separators or compact suffixes.
static int splitString(const char *stringSplit, const char *search, std::vector< std::string > &result)
Split a narrow string into a vector.
static int countEntry(T *pString, T entry, int begin=0)
Count occurrences of a character.
Definition CStringImp.h:237
static int length(T *pString)
Count characters before the null terminator.
Definition CStringImp.h:57
static unsigned short * getUnicodeString(const wchar_t *src)
Convert a wide string to an unsigned 16-bit Unicode buffer.
static void getFileName(T1 *dstString, T2 *lpString)
Extract the file name from a path.
Definition CStringImp.h:729
static void replaceExt(char *lpPath, const char *lpExt)
Replace the extension portion of a file name in place.
static void getFileNameExt(T1 *dstString, T2 *lpString)
Extract the file extension from a path.
Definition CStringImp.h:750
static const std::wstring & convertUTF8ToUnicode(const char *src)
Convert UTF-8 text to wide-character text using shared temporary storage.
static void shortName(T *dest, const T *name, int maxchar)
Shorten a name to a maximum character count.
Definition CStringImp.h:816
static int mid(T1 *pStringDst, T2 *pStringSrc, int begin, int end)
Copy a substring range.
Definition CStringImp.h:373
static int copyAt(T1 *pStringDst, T2 *pStringSrc, int at)
Copy a source string into a destination string at an index.
Definition CStringImp.h:286
static int comp(T *pString1, T *pString2, int len)
Compare a fixed number of characters by raw character bytes.
Definition CStringImp.h:359
static void inorgeLoopChar(T *pString, T charLoop)
Collapse repeated occurrences of a character to a single occurrence.
Definition CStringImp.h:500
static void replacePathExt(char *lpPath, const char *lpExt)
Replace the extension portion of a full path in place.
static std::string replaceAll(std::string &string, const std::string &from, const std::string &to)
Replace every occurrence of a substring.
static bool parseFromHex(T *lpString, int *result)
Parse a hexadecimal integer from a string.
Definition CStringImp.h:663
static void trim(T *pString)
Remove leading and trailing whitespace characters.
Definition CStringImp.h:209
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29