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..
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
You can use Regex.Split
:
string[] parts = Regex.Split(text, @"\. ");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With