Is there an easy way to trim the leading and ending/trailing whitespace of a string, but not trim any whitespace in the middle? I see the TrimStart and TrimEnd functions but am unsure how to use them. Please help! Thanks
.Trim should work
" a b c ".Trim
will give you "a b c"
Regards
5 Likes
That does not seem to be working in this case
Nevermind, I was wrong. Thank you for your help
Hi @jpreziuso,
Additionally, TrimStart trims the whitespaces in the beginning and TrimEnd in the ending of a String.
To trim all the whitespaces including in between the characters, use String.Replace(" ", “”)
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.