Skip to content

Commit

Permalink
Fix StringReplace looping forever when replacing character when rep…
Browse files Browse the repository at this point in the history
…lacing same character as match (#736)

Find the next replacement starting from the end of the last one, instead of from the start of the string
  • Loading branch information
ASpoonPlaysGames authored Oct 11, 2023
1 parent add7305 commit 3714f23
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ string function StringReplace( string baseString, string searchString, string re
source = part1 + replaceString + part2

loopedOnce = true
findResult = source.find( searchString )
findResult = source.find( searchString, findResult + replaceString.len() )
}

return baseString
Expand Down

0 comments on commit 3714f23

Please sign in to comment.