File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,9 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES String
267267 }
268268 #endif
269269
270+ bool __StartsWith (const String &inValue) const ;
271+ bool __EndsWith (const String &inValue) const ;
272+
270273
271274 ::String &operator+=(const ::String &inRHS);
272275 ::String operator+(const ::String &inRHS) const ;
Original file line number Diff line number Diff line change @@ -1676,6 +1676,48 @@ int String::compare(const ::String &inRHS) const
16761676}
16771677#endif
16781678
1679+ bool String::__StartsWith (const String &inValue) const
1680+ {
1681+ int l = inValue.length ;
1682+
1683+ if (l > length)
1684+ return false ;
1685+
1686+ bool s016 = isUTF16Encoded ();
1687+ bool s116 = inValue.isUTF16Encoded ();
1688+ if (s016 && s116)
1689+ {
1690+ return memcmp (__w, inValue.__w , l * sizeof (char16_t )) == 0 ;
1691+ }
1692+ else if (s016 || s116)
1693+ {
1694+ return s016 ? StrMatch (__w, inValue.__s , l) :
1695+ StrMatch (inValue.__w , __s, l);
1696+ }
1697+ return memcmp (__s, inValue.__s , l) == 0 ;
1698+ }
1699+
1700+ bool String::__EndsWith (const String &inValue) const
1701+ {
1702+ int l = inValue.length ;
1703+
1704+ if (l > length)
1705+ return false ;
1706+
1707+ bool s016 = isUTF16Encoded ();
1708+ bool s116 = inValue.isUTF16Encoded ();
1709+ if (s016 && s116)
1710+ {
1711+ return memcmp (__w + (length - l), inValue.__w , l * sizeof (char16_t )) == 0 ;
1712+ }
1713+ else if (s016 || s116)
1714+ {
1715+ return s016 ? StrMatch (__w + (length - l), inValue.__s , l) :
1716+ StrMatch (inValue.__w , __s + (length - l), l);
1717+ }
1718+ return memcmp (__s + (length - l), inValue.__s , l) == 0 ;
1719+ }
1720+
16791721
16801722namespace hx
16811723{
You can’t perform that action at this time.
0 commit comments