Language: Add ToBoolean, EMIBenchmark: try blocks

This commit is contained in:
Jonathan Jenne
2020-04-22 14:34:22 +02:00
parent 162485e3f0
commit d2717b9216
2 changed files with 46 additions and 33 deletions

View File

@@ -22,6 +22,11 @@ Public Class Utils
Return [Enum].Parse(GetType(T), value)
End Function
Public Shared Function ToBoolean(input As String) As Boolean
If String.IsNullOrEmpty(input) Then Return False
Return (input.Trim().ToLower() = "true") OrElse (input.Trim() = "1")
End Function
''' <summary>
''' Checks a value for three different `null` values,
''' Nothing, Empty String, DBNull