string.firstSentence

Syntax string.firstSentence (string)

Params string is the string of characters from which you wish to extract the first sentence.

Action Removes from string all of the characters up to and including the first period followed by at least one blank space.

Returns The resulting string.

Examples string.firstSentence ("Space. The final frontier.")

   » Space.

Note that punctuation is returned. Trailing spaces, however, are not.

string.firstSentence ("suites.todo.lists is first. Then comes other stuff.")

   » suites.to.do.lists is first.

The first three periods are not followed by spaces and are therefore not sentence enders.

string.lastWord (string.firstSentence ("Let's go for a swim. It's so hot!"))

   » swim.

Discuss