summaryrefslogtreecommitdiff
path: root/core/fxcrt/include
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/include')
-rw-r--r--core/fxcrt/include/fx_string.h12
-rw-r--r--core/fxcrt/include/fx_system.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h
index 66a8039a8d..fbfb91f759 100644
--- a/core/fxcrt/include/fx_string.h
+++ b/core/fxcrt/include/fx_string.h
@@ -100,6 +100,12 @@ class CFX_ByteStringC {
uint8_t GetAt(FX_STRSIZE index) const { return m_Ptr[index]; }
+ FX_STRSIZE Find(FX_CHAR ch) const {
+ const uint8_t* found =
+ static_cast<const uint8_t*>(memchr(m_Ptr, ch, m_Length));
+ return found ? found - m_Ptr : -1;
+ }
+
CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const {
if (index < 0) {
index = 0;
@@ -417,6 +423,12 @@ class CFX_WideStringC {
return CFX_WideStringC(m_Ptr, count);
}
+ FX_STRSIZE Find(FX_WCHAR ch) const {
+ const FX_WCHAR* found =
+ static_cast<const FX_WCHAR*>(wmemchr(m_Ptr, ch, m_Length));
+ return found ? found - m_Ptr : -1;
+ }
+
CFX_WideStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const {
if (index < 0) {
index = 0;
diff --git a/core/fxcrt/include/fx_system.h b/core/fxcrt/include/fx_system.h
index 795a0c2794..b4659d14e4 100644
--- a/core/fxcrt/include/fx_system.h
+++ b/core/fxcrt/include/fx_system.h
@@ -123,7 +123,6 @@ void FXSYS_vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
#define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE
#define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE
-#define FXSYS_strchr strchr
#define FXSYS_strncmp strncmp
#define FXSYS_strcmp strcmp
#define FXSYS_strcpy strcpy
@@ -166,7 +165,6 @@ extern "C" {
#endif
#define FXSYS_wcscmp wcscmp
-#define FXSYS_wcschr wcschr
#define FXSYS_wcsstr wcsstr
#define FXSYS_wcsncmp wcsncmp
#define FXSYS_vswprintf vswprintf
@@ -176,7 +174,6 @@ extern "C" {
#define FXSYS_memcpy memcpy
#define FXSYS_memmove memmove
#define FXSYS_memset memset
-#define FXSYS_memchr memchr
#define FXSYS_qsort qsort
#define FXSYS_bsearch bsearch