Skip to content

Commit

Permalink
Update StringExtensions.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
adammyhre authored Apr 23, 2024
1 parent 094bf11 commit 26bdad4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions UnityUtils/Scripts/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public static class StringExtensions {
/// <summary>Checks if a string contains null, empty or white space.</summary>
public static bool IsBlank(this string val) => val.IsNullOrWhiteSpace() || val.IsNullOrEmpty();

/// <summary>Returns an empty string if the string is null or empty or white space.</summary>
public static string OrEmpty(this string val) => val.IsBlank() ? string.Empty : val;
/// <summary>Checks if a string is null and returns an empty string if it is.</summary>
public static string OrEmpty(this string val) => val ?? string.Empty;

/// <summary>
/// Shortens a string to the specified maximum length. If the string's length
Expand Down Expand Up @@ -42,4 +42,4 @@ public static string Slice(this string val, int startIndex, int endIndex) {

return val.Substring(startIndex, endIndex - startIndex);
}
}
}

0 comments on commit 26bdad4

Please sign in to comment.