From fb489484b50e0faf1b91825aa849397904e7e0ef Mon Sep 17 00:00:00 2001 From: Dmitrii Ivashchenko Date: Wed, 8 Nov 2023 14:14:34 +0100 Subject: [PATCH] Update Utils.cs --- Eventify/Core/Runtime/Utils.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Eventify/Core/Runtime/Utils.cs b/Eventify/Core/Runtime/Utils.cs index 0032c29..8ac09a6 100644 --- a/Eventify/Core/Runtime/Utils.cs +++ b/Eventify/Core/Runtime/Utils.cs @@ -20,6 +20,7 @@ public static bool InRange(this int i, float min, float max) public static string RemoveFirstLines(this string text, int linesCount) { var lines = Regex.Split(text, "\r\n|\r|\n").Skip(linesCount); + return string.Join(Environment.NewLine, lines.ToArray()); } @@ -35,9 +36,12 @@ public static bool ContainsIgnoreCase(this string source, string toCheck, String public static T GetRandom(this IList list) { - if (list.Count == 0) throw new ArgumentException("list length can't be zero"); - var randomIndex = UnityEngine.Random.Range(0, list.Count); - return list[randomIndex]; + if (list.Count == 0) + { + throw new ArgumentException("list length can't be zero"); + } + + return list[UnityEngine.Random.Range(0, list.Count)]; } } }