Last active
December 4, 2015 15:38
-
-
Save javierguerrero/7cf03fc04209ad31ce60 to your computer and use it in GitHub Desktop.
How to remove trailing slash in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Here is an example: | |
string fileName = "Test/"; | |
fileName= fileName.TrimEnd(new[] { '/' }); | |
//With this method you can also specify multiple characters so you may want to remove all slash or backslash using the array. | |
string fileName = "Test\\"; | |
fileName= fileName.TrimEnd(new[] { '/', '\\' }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment