mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: String::FindAfter
git-svn-id: svn://ultimatepp.org/upp/trunk@7225 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
930c9985f5
commit
307d763b5b
2 changed files with 14 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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])&]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue