Convert Text with newlines to a List<String>
Posted
by
Vaccano
on Stack Overflow
See other posts from Stack Overflow
or by Vaccano
Published on 2011-01-10T20:21:17Z
Indexed on
2011/01/10
20:53 UTC
Read the original article
Hit count: 200
I need a way to take a list of numbers in string form to a List object.
Here is an example:
string ids = "10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19";
List<String> idList = new List<String>();
idList.SomeCoolMethodToParseTheText(ids); <------+
|
foreach (string id in idList) |
{ |
// Do stuff with each id. |
} |
|
// This is the Method that I need ----------------+
Is there something in the .net library so that I don't have to write the SomeCoolMethodToParseTheText
myself?
© Stack Overflow or respective owner