Rtrim and Ltrim specific chars in VB.Net

Dim char_array_end = "<br />".ToCharArray
Dim char_array_start = "I ".ToCharArray

Dim my_string = "I love pizza, beer, sambuca<br />"
Dim my_string_trimmed = my_string.TrimEnd(char_array_end)

Console.WriteLine(my_string_trimmed) 
'I love pizza, beer, sambuca'

my_string_trimmed = my_string.TrimStart(char_array_start)

Console.WriteLine(my_string_trimmed) 
'love pizza, beer, sambuca<br />'

Leave a Comment

Your email address will not be published. Required fields are marked *