in C# I can use the StringSplitOption.None enum element to specify that I want empty strings to be included in the resulting array:
String[] s = text.Split(new String[] { "\r\n" }, StringSplitOptions.None);
In java I can do the following:
String[] s= text.split("\r\n");
However, the split method does not return empty strings. (So if text = "a\r\nb\r\n", I want to get {a, b, ""}, rather than {a, b}).
Is there an easy way to accomplish this either via a regex or using some other method?