Skip to content

Commit

Permalink
Added IsNumeric function
Browse files Browse the repository at this point in the history
  • Loading branch information
EliaSulimanov committed May 27, 2020
1 parent 77cf5c4 commit 21864f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/Cosmos.Common/StringHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,16 @@ public static int Compare(string aString1, int aIndex1, string aString2, int aIn
}
return (int)StringComparisonResultEnum.Equal;
}

/// <summary>
/// Check if string is numeric.
/// </summary>
/// <param name="aString">A string to check if numeric.</param>
/// <returns>Returns TRUE if string is numeric.</returns>
public static bool IsNumeric(string aString) {
int i = 0;
return int.TryParse(aString, out i);
}
}
}

0 comments on commit 21864f6

Please sign in to comment.