Skip to content

Commit 46df28f

Browse files
Maullerxezon
authored andcommitted
chore(string): Implement find() and reverseFind() functions in UnicodeString (TheSuperHackers#2635)
1 parent 9dd5c74 commit 46df28f

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Core/GameEngine/Include/Common/UnicodeString.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,16 @@ class UnicodeString
306306
*/
307307
int compareNoCase(const WideChar* s) const;
308308

309+
/**
310+
Conceptually identical to wcschr().
311+
*/
312+
const WideChar* find(WideChar c) const;
313+
314+
/**
315+
Conceptually identical to wcsrchr().
316+
*/
317+
const WideChar* reverseFind(WideChar c) const;
318+
309319
/**
310320
return true iff self starts with the given string.
311321
*/
@@ -485,6 +495,18 @@ inline int UnicodeString::compareNoCase(const WideChar* s) const
485495
return _wcsicmp(this->str(), s);
486496
}
487497

498+
// -----------------------------------------------------
499+
inline const WideChar* UnicodeString::find(WideChar c) const
500+
{
501+
return wcschr(this->str(), c);
502+
}
503+
504+
// -----------------------------------------------------
505+
inline const WideChar* UnicodeString::reverseFind(WideChar c) const
506+
{
507+
return wcsrchr(this->str(), c);
508+
}
509+
488510
// -----------------------------------------------------
489511
inline Bool operator==(const UnicodeString& s1, const UnicodeString& s2)
490512
{

0 commit comments

Comments
 (0)