-
Couldn't load subscription status.
- Fork 0
ProtoString enumerateLines() Method
Seth Clydesdale edited this page Jun 2, 2015
·
2 revisions
<< Back to Miscellaneous Methods
Numbering each newline.
'Coffee\nCream\nSugar'.enumerateLines();
// returns the following string
`1. Coffee
2. Cream
3. Sugar`Passing true as the parameter will start the listing at 0.
'Coffee\nCream\nSugar'.enumerateLines(true);
// returns the following string
`0. Coffee
1. Cream
2. Sugar`The enumerateLines method numbers out each line by placing a number at the beginning of newlines. The listing starts at 1, however, if specified it can start at 0.
String.enumerateLines(zero);| Parameter | Description |
|---|---|
| zero | A boolean value that specifies the listing should be zero-based. If set to true the first line will be numbered 0. Defaults to listing the first line as 1 if left undefined. |
Home • History • ProtoString • Created by Seth Clydesdale