In my application I want to send message to a device... the device accepts only 14 characters at a time, so if I have a string of 100 characters means I have to split 14 characters a time and send the message for that I tried to use this method
string input = "First sentence. Second sentence! Third sentence? Yes.";
string[] sentences = Regex.Split(input, @"(?<=[\.!\?])\s+");
foreach (string sentence in sentences) {
Console.WriteLine(sentence);
}
The above sample code splits the sentences as I want but sometime it splits more than 14 characters
The tricky situation I am facing... the sentence should be below 14 characters and also it should be a complete sentence
Code should split the sentences and length should be below 14 characters can anyone help me.