How would I trim a string that has a length greater than 6 characters? I've searched the forums but haven't found what I am looking for yet... any help would be appreciated!
Thanks!
Printable View
How would I trim a string that has a length greater than 6 characters? I've searched the forums but haven't found what I am looking for yet... any help would be appreciated!
Thanks!
The Length of a String has no bearing on the Trim, TrimStart and TrimEnd methods. They will remove all occurrences of a character or characters from the start, end or both of a String. If you mean how can you get just the first six characters then you would use the Substring method:VB Code:
Dim newString As String = oldString.Substring(0, Math.Min(6, oldString.Length))
Quote:
Originally Posted by jmcilhinney
thank you!