I’m looking through the functionality of the Split ability of Strings in c#, and I was wondering if there was a way that I could split a string based on number of characters rather than a specific delimiter?
For example, can I split “cat dog” in a way that would fill the first 7 slots in an array, since there are 6 characters and a space.
Or is it required that you specify a delimiter to split on?
Are you looking for
String.ToCharArray()? That creates an array of characters…However, bear in mind that
stringalready supports both iteration and indexing anyway: