Tools: String Manipulations Find Dupes My IP Json Formatter Lorem Ipsum More...
Discussion Options
ajax animation

C# .NET: Split a String, Trim, and ToLower All Elements

7/22/2014 9:13:25 PM by: CodeLocker

The following will take a comma delimited string, trim, and toLower() all of the resulting elements. This will

View Copy: Content Copied
string commaDelimitedString = "a, B, C, d, E";
    List<string> elements = commaDelimitedString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim().ToLower()).ToList();
Copy: Content Copied
ajax animation
×

Get Coding

Store your first code or add more code to your collection.
You must login to report abuse. ×