[Solved] How to split a string by a specific character? [duplicate]


var myString = "0001-102525";
var splitString = myString.Split("-");

Then access either like so:

splitString[0] and splitString[1]

Don’t forget to check the count/length if you are splitting user inputted strings as they may not have entered the ‘-‘ which would cause an OutOfRangeException.

solved How to split a string by a specific character? [duplicate]