Imports System
Namespace de.Fesslersoft.Extensions
Public Friend Module Extensions
<System.Runtime.CompilerServices.Extension> _
Public Function Left(input As String, length As Integer) As [String]
Dim result = ""
If (input.Length <= 0) Then
Return result
End If
If (length > input.Length) Then
length = input.Length
End If
result = input.Substring(0, length)
Return result
End Function
<System.Runtime.CompilerServices.Extension> _
Public Function Mid(input As String, start As Integer, length As Integer) As [String]
Dim result = ""
If ((input.Length <= 0) OrElse (start >= input.Length)) Then
Return result
End If
If (start + length > input.Length) Then
length = (input.Length - start)
End If
result = input.Substring(start, length)
Return result
End Function
<Runtime.CompilerServices.Extension> _
Public Function Right(input As String, length As Integer) As [String]
Dim result = ""
If (input.Length <= 0) Then
Return result
End If
If (length > input.Length) Then
length = input.Length
End If
result = input.Substring((input.Length - length), length)
Return result
End Function
End Module
End Namespace