UnityEssentials
Small but useful tools and features for Unity
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
StringExtensions.cs
Go to the documentation of this file.
1 namespace UnityEngine
2 {
6 
7  public static class StringExtensions
8  {
9 
14  public static string EnsureEndsWithDot(this string str)
15  {
16  if (!str.EndsWith(".")) return str + ".";
17  return str;
18  }
19 
24  public static bool IsNullEmptyOrWhiteSpace(this string str)
25  {
26  return /*string.IsNullOrEmpty(str) ||*/ string.IsNullOrWhiteSpace(str); // 'IsNullOrWhiteSpace' already checks for emptiness
27  }
28 
33  public static bool IsNullOrEmpty(this string str)
34  {
35  return string.IsNullOrEmpty(str);
36  }
37 
38  }
39 }
Extensions for string
static string EnsureEndsWithDot(this string str)
Ensures that the string ends with a dot ('.').
static bool IsNullOrEmpty(this string str)
Indicates whether the specified string is null or an empty string ("").
static bool IsNullEmptyOrWhiteSpace(this string str)
Indicates whether a specified string is null, empty, or consists only of white-space characters.