mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: String::Replace now supports all 4 signature variants (RM #250)
git-svn-id: svn://ultimatepp.org/upp/trunk@4569 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
d6094529e5
commit
7b82c53a0c
4 changed files with 33 additions and 5 deletions
|
|
@ -140,6 +140,12 @@ int AString<B>::Find(int len, const tchar *s, int from) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
template <class B>
|
||||
void AString<B>::Replace(const String& find, const String& replace)
|
||||
{
|
||||
Replace(~find, find.GetCount(), ~replace, replace.GetCount());
|
||||
}
|
||||
|
||||
template <class B>
|
||||
force_inline
|
||||
void AString<B>::Replace(const tchar *find, const tchar *replace)
|
||||
|
|
@ -147,6 +153,20 @@ void AString<B>::Replace(const tchar *find, const tchar *replace)
|
|||
Replace(find, (int)strlen__(find), replace, (int)strlen__(replace));
|
||||
}
|
||||
|
||||
template <class B>
|
||||
force_inline
|
||||
void AString<B>::Replace(const String& find, const tchar *replace)
|
||||
{
|
||||
Replace(~find, find.GetCount(), replace, (int)strlen__(replace));
|
||||
}
|
||||
|
||||
template <class B>
|
||||
force_inline
|
||||
void AString<B>::Replace(const tchar *find, const String& replace)
|
||||
{
|
||||
Replace(find, (int)strlen__(find), ~replace, replace.GetCount());
|
||||
}
|
||||
|
||||
template <class B>
|
||||
bool AString<B>::StartsWith(const tchar *s, int len) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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; ]
|
||||
[s3; ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue