G
George
I am new to VB, I need 2 string functions to return last char and remove
last char.
I made them up.
Am I recreating the wheel? do similar functions exist in String? I could not
find them
Public Class StringCode
Public Shared Function LastStringChar(ByVal str As String) As Char
If (str.Length > 0) Then
Return str.Chars(str.Length - 1)
End If
Return ""
End Function
Public Shared Function RemoveLastStringChar(ByRef str As String) As String
If (str.Length > 0) Then
str = str.Remove(str.Length - 1, 1)
End If
Return str
End Function
End Class
last char.
I made them up.
Am I recreating the wheel? do similar functions exist in String? I could not
find them
Public Class StringCode
Public Shared Function LastStringChar(ByVal str As String) As Char
If (str.Length > 0) Then
Return str.Chars(str.Length - 1)
End If
Return ""
End Function
Public Shared Function RemoveLastStringChar(ByRef str As String) As String
If (str.Length > 0) Then
str = str.Remove(str.Length - 1, 1)
End If
Return str
End Function
End Class