Skip to content

Commit 6c323fa

Browse files
committed
EvilBeaver#1603 fix strReplase
1 parent 241d438 commit 6c323fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/OneScript.Native/Runtime/BuiltInFunctions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*----------------------------------------------------------
1+
/*----------------------------------------------------------
22
This Source Code Form is subject to the terms of the
33
Mozilla Public License, v.2.0. If a copy of the MPL
44
was not distributed with this file, You can obtain one
@@ -178,7 +178,7 @@ public static int ChrCode(string strChar, int? position = null)
178178
[MethodImpl(MethodImplOptions.AggressiveInlining)]
179179
[ContextMethod("СтрЗаменить", "StrReplace")]
180180
public static string StrReplace(string sourceString, string searchVal, string newVal) =>
181-
sourceString.Replace(searchVal, newVal);
181+
!string.IsNullOrEmpty(searchVal) ? sourceString.Replace(searchVal, newVal):sourceString;
182182

183183
[ContextMethod("СтрПолучитьСтроку", "StrGetLine")]
184184
public static string StrGetLine(string strArg, int lineNumber)

0 commit comments

Comments
 (0)