From 3714f23edde5a48aa29560dc74fc5a59ce2ca85a Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:57:00 +0100 Subject: 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 --- Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Northstar.CustomServers/mod/scripts/vscripts') 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 -- cgit v1.2.3