What I need to do is parse a huge string of text into sentences. Sentences are isolated by looking for a terminator. Terminators include ‘.’ and ‘?’ and ‘:’ and ellipsis (“…”).
is there a way I can say
if (char is terminator)
{
// do this
}
in a clean manner instead of
if (char == '.' || char == '?' || char == etc etc etc etc )
i did think of doing having an array of the terminators and doing
if (ArrayofTerminators.Contains<char>('thechar'))
{
// do that
}
but that seems silly too?
*edit Thanks. Was hard to chose with so many good replies. Anyway I devided to go with UnhandledException’s answer because it’s compact and elegant and just what I was looking for really.
1 Answer