diff --git a/uppsrc/Core/AString.hpp b/uppsrc/Core/AString.hpp index ac1558e35..1bbfb0ea3 100644 --- a/uppsrc/Core/AString.hpp +++ b/uppsrc/Core/AString.hpp @@ -140,6 +140,12 @@ int AString::Find(int len, const tchar *s, int from) const return -1; } +template +void AString::Replace(const String& find, const String& replace) +{ + Replace(~find, find.GetCount(), ~replace, replace.GetCount()); +} + template force_inline void AString::Replace(const tchar *find, const tchar *replace) @@ -147,6 +153,20 @@ void AString::Replace(const tchar *find, const tchar *replace) Replace(find, (int)strlen__(find), replace, (int)strlen__(replace)); } +template +force_inline +void AString::Replace(const String& find, const tchar *replace) +{ + Replace(~find, find.GetCount(), replace, (int)strlen__(replace)); +} + +template +force_inline +void AString::Replace(const tchar *find, const String& replace) +{ + Replace(find, (int)strlen__(find), ~replace, replace.GetCount()); +} + template bool AString::StartsWith(const tchar *s, int len) const { diff --git a/uppsrc/Core/Debug.cpp b/uppsrc/Core/Debug.cpp index f0dfffe07..75c9b0dfd 100644 --- a/uppsrc/Core/Debug.cpp +++ b/uppsrc/Core/Debug.cpp @@ -482,8 +482,8 @@ void InstallCrashDump(const char *info) { #ifdef _DEBUG // value inspectors for Gdb_MI2 frontend -word _DBG_Value_GetType(Value const &v) { return v.GetType(); } -String _DBG_Value_AsString(Value const &v) { return AsString(v); } +dword _DBG_Value_GetType(Value const &v) { return v.GetType(); } +String _DBG_Value_AsString(Value const &v) { return AsString(v); } #endif END_UPP_NAMESPACE diff --git a/uppsrc/Core/String.h b/uppsrc/Core/String.h index d8a611128..167cb506b 100644 --- a/uppsrc/Core/String.h +++ b/uppsrc/Core/String.h @@ -96,8 +96,10 @@ public: int ReverseFind(const String& s) const { return ReverseFind(s, GetLength()-1);} void Replace(const tchar *find, int findlen, const tchar *replace, int replacelen); - void Replace(const String& find, const String& replace) { Replace(~find, find.GetCount(), ~replace, replace.GetCount()); } + void Replace(const String& find, const String& replace); void Replace(const tchar *find, const tchar *replace); + void Replace(const String& find, const tchar *replace); + void Replace(const tchar *find, const String& replace); bool StartsWith(const tchar *s, int len) const; bool StartsWith(const tchar *s) const; diff --git a/uppsrc/Core/src.tpp/String$en-us.tpp b/uppsrc/Core/src.tpp/String$en-us.tpp index b72980372..9d803057e 100644 --- a/uppsrc/Core/src.tpp/String$en-us.tpp +++ b/uppsrc/Core/src.tpp/String$en-us.tpp @@ -539,6 +539,7 @@ onst]&] [@(0.0.255) int]_[*@3 from]_`=_[@3 0])_[@(0.0.255) const]&] [s2; Returns first position of substring [%-*@3 s] tested from [%-*@3 from] position, or `-1 if [%-*@3 s] is not found.&] +[s3; &] [s4;%- &] [s5;:AString`:`:Replace`(const AString`:`:String`&`,const AString`:`:String`&`):%- [@(0.0.255) v oid]_[* Replace]([@(0.0.255) const]_[_^AString`:`:String^ String][@(0.0.255) `&]_[*@3 find], @@ -546,7 +547,12 @@ oid]_[* Replace]([@(0.0.255) const]_[_^AString`:`:String^ String][@(0.0.255) `&] [s5;:AString`:`:Replace`(const AString`:`:tchar`*`,const AString`:`:tchar`*`):%- [@(0.0.255) v oid]_[* Replace]([@(0.0.255) const]_[_^AString`:`:tchar^ tchar]_`*[*@3 find], [@(0.0.255) const]_[_^AString`:`:tchar^ tchar]_`*[*@3 replace])&] +[s5;:AString`:`:Replace`(const AString`:`:String`&`,const AString`:`:tchar`*`):%- [@(0.0.255) v +oid]_[* Replace]([@(0.0.255) const]_[_^AString`:`:String^ String][@(0.0.255) `&]_[*@3 find], + [@(0.0.255) const]_[_^AString`:`:tchar^ tchar]_`*[*@3 replace])&] +[s5;:AString`:`:Replace`(const AString`:`:tchar`*`,const AString`:`:String`&`):%- [@(0.0.255) v +oid]_[* Replace]([@(0.0.255) const]_[_^AString`:`:tchar^ tchar]_`*[*@3 find], +[@(0.0.255) const]_[_^AString`:`:String^ String][@(0.0.255) `&]_[*@3 replace])&] [s2; Replaces substring [%-*@3 find] with [%-*@3 replace ]string for all times [%-*@3 find] string appears.&] -[s3; &] -[s0; ] \ No newline at end of file +[s3; ] \ No newline at end of file