diff --git a/uppsrc/Core/String.h b/uppsrc/Core/String.h index 93671d772..6c3b296ce 100644 --- a/uppsrc/Core/String.h +++ b/uppsrc/Core/String.h @@ -91,6 +91,9 @@ public: int Find(int len, const tchar *s, int from) const { return find(B::Begin(), B::GetCount(), s, len, from); } int Find(const tchar *s, int from = 0) const { return Find(strlen__(s), s, from); } int Find(const String& s, int from = 0) const { return Find(s.GetCount(), ~s, from); } + + int FindAfter(const tchar *s, int from = 0) const { int n = strlen__(s); int q = Find(n, s, from); return q < 0 ? -1 : q + n; } + int FindAfter(const String& s, int from = 0) const { int n = s.GetCount(); int q = Find(n, ~s, from); return q < 0 ? -1 : q + n; } int ReverseFind(int len, const tchar *s, int from) const; int ReverseFind(const tchar *s, int from) const; diff --git a/uppsrc/Core/src.tpp/String$en-us.tpp b/uppsrc/Core/src.tpp/String$en-us.tpp index e6adc85fd..76d46f7ff 100644 --- a/uppsrc/Core/src.tpp/String$en-us.tpp +++ b/uppsrc/Core/src.tpp/String$en-us.tpp @@ -542,6 +542,17 @@ onst]&] position, or `-1 if [%-*@3 s] is not found.&] [s3; &] [s4;%- &] +[s5;:AString`:`:FindAfter`(const AString`:`:tchar`*`,int`)const:%- [@(0.0.255) int]_[* Fi +ndAfter]([@(0.0.255) const]_[_^AString`:`:tchar^ tchar]_`*[*@3 s], +[@(0.0.255) int]_[*@3 from]_`=_[@3 0])_[@(0.0.255) const]&] +[s5;:AString`:`:FindAfter`(const AString`:`:String`&`,int`)const:%- [@(0.0.255) int]_[* F +indAfter]([@(0.0.255) const]_[_^AString`:`:String^ String][@(0.0.255) `&]_[*@3 s], +[@(0.0.255) int]_[*@3 from]_`=_[@3 0])_[@(0.0.255) const]&] +[s2; Similiar to Find, but if found, returns position [*/ after] the +substring found. In other words, if not found returns `-1, if +found, returns Find([%-*@3 s][%- , ][%-*@3 from]) `+ strlen([%-*@3 s]).&] +[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], [@(0.0.255) const]_[_^AString`:`:String^ String][@(0.0.255) `&]_[*@3 replace])&]