i need to split this text
This is really cool, and i like it.
into this
this
is
really
cool
,
and
i
like
it
.
Any idea how to do this? splitting with space give this
this
is
really
cool,
and
i
like
it.
i need the punctuation i a separate element of an array
thanks
You cannot use String.Split to split on “nothing”.
Instead, you could use
Regex.Splitto do this:In this pattern, we either match a space (which gets “consumed”), OR, we do a look-ahead for punctuation (and don’t “consume” it).