mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-26 02:14:22 +00:00
tidied up String::replaceFirstOccurrenceOf() method
This commit is contained in:
parent
3cef6dcbdf
commit
e7ebd069e3
1 changed files with 4 additions and 5 deletions
|
|
@ -1328,12 +1328,11 @@ String String::replace (StringRef stringToReplace, StringRef stringToInsert, con
|
|||
String String::replaceFirstOccurrenceOf (StringRef stringToReplace, StringRef stringToInsert, const bool ignoreCase) const
|
||||
{
|
||||
const int stringToReplaceLen = stringToReplace.length();
|
||||
const int index = ignoreCase ? indexOfIgnoreCase (stringToReplace)
|
||||
: indexOf (stringToReplace);
|
||||
|
||||
int i = 0;
|
||||
|
||||
if ((i = (ignoreCase ? indexOfIgnoreCase (stringToReplace)
|
||||
: indexOf (stringToReplace))) >= 0)
|
||||
return replaceSection (i, stringToReplaceLen, stringToInsert);
|
||||
if (index >= 0)
|
||||
return replaceSection (index, stringToReplaceLen, stringToInsert);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue