c# - How to split up a paragraph using words -
my question is, how split paragraph example 2 strings? part , part b? reading word document using docx dll. keep in mind text may change. full stops may not present. paragraphs divided part a,b,c , on.... thanks!
"part close no matter how far. couldn't more heart.forever trusting are.and nothing else matters.part b never opened myself way. life ours, live our way.all these words don't say.and nothing else matters"
you use regular expressions split paragraph lines, if division done on part a, part b etc.
string para = "part close no matter how far. couldn't more heart.forever trusting are.and nothing else matters.part b never opened myself way. life ours, live our way.all these words don't say.and nothing else matters"; regex regex = new regex("part [a-z] ", regexoptions.ignorecase); string[] lines = regex.split(para).where(s => s != string.empty).toarray();
Comments
Post a Comment