سلام به همه.
دو Extension Method برای متغیر های رشته ای: حذف کاراکتر از انتهای رشته به تعداد ورودی len
Imports System.Runtime.CompilerServices
Module StringExtensions
<Extension()> Function RemoveEnd(Str As String, Optional len As Integer = 1) As String
If Str.Length = 0 Then Return ""
Return Str.Remove(Str.Length - len, len)
End Function
<Extension()> Sub RemovingEnd(ByRef Str As String, Optional len As Integer = 1)
If Str.Length > 0 Then
Str = Str.Remove(Str.Length - len, len)
End If
End Sub
End Module