diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-10-11 21:57:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 22:57:00 +0200 |
commit | 3714f23edde5a48aa29560dc74fc5a59ce2ca85a (patch) | |
tree | d9e268fc0f005420265d71ba694a8ee1dcf78376 /Northstar.CustomServers/mod/scripts/vscripts | |
parent | add7305318b6fc1fe74389c60c352a19bddd7748 (diff) | |
download | NorthstarMods-3714f23edde5a48aa29560dc74fc5a59ce2ca85a.tar.gz NorthstarMods-3714f23edde5a48aa29560dc74fc5a59ce2ca85a.zip |
Fix `StringReplace` looping forever when replacing character when replacing 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
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut index a2de9913..9e762985 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut @@ -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 |