I have string string text = "1.2788923 is a decimal number. 1243818 is an integer. "; Is there a way to split it on the commas only ? This means to split on ". " but not on '.'. When I try string[] sentences = text.Split(". "); I get method has invalid arguments error..
-
1Use this overload of String.Split: msdn.microsoft.com/en-us/library/tabh47cf(v=vs.110).aspxken2k– ken2k2013-11-05 17:38:57 +00:00Commented Nov 5, 2013 at 17:38
Add a comment
|
4 Answers
Use String.Split Method (String[], StringSplitOptions) to split it like:
string[] sentences = text.Split(new string[] { ". " },StringSplitOptions.None);
You will end up with two items in your string:
1.2788923 is a decimal number
1243818 is an integer