Skip to content

ProtoString toSentenceCase() Method

Seth Clydesdale edited this page May 23, 2015 · 3 revisions

<< Back to Case Manipulation Methods

Examples

Capitalizing the first letter in every sentence.

'sentence one leads sentence two. while sentence two follows sentence one.\n\nsentence three is on its own, on line three.'.toSentenceCase();

// With the output being the following string
`Sentence one leads sentence two. While sentence two follows sentence one.

Sentence three is on its own, on line three.`

Capitalizing the first letter on every newline.

'line 1\nline 2\nline 3'.toSentenceCase();

// With the output being the following string
`Line 1
Line 2
Line 3`

Description

The toSentenceCase method is used to capitalize the first letter of every sentence and newline.

Syntax

String.toSentenceCase();
Clone this wiki locally