From f685a945be42a60e85593c4e062a2821165f740a Mon Sep 17 00:00:00 2001 From: Travis CI Date: Fri, 29 Dec 2017 11:01:28 +0000 Subject: [PATCH] Travis build: 475 --- README.md | 24 ++++++++++++++++++++++++ docs/index.html | 8 ++++++++ 2 files changed, 32 insertions(+) diff --git a/README.md b/README.md index bde7d8eff..9ef8e268f 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,7 @@ * [`repeatString`](#repeatstring) * [`reverseString`](#reversestring) * [`sortCharactersInString`](#sortcharactersinstring) +* [`splitLines`](#splitlines) * [`toCamelCase`](#tocamelcase) * [`toKebabCase`](#tokebabcase) * [`toSnakeCase`](#tosnakecase) @@ -3577,6 +3578,29 @@ sortCharactersInString('cabbage'); // 'aabbceg' [⬆ Back to top](#table-of-contents) +### splitLines + +Splits a multiline string into an array of lines. + +Use `String.split()` and a regular expression to match line breaks and create an array. + +```js +const splitLines = str => str.split(/\r?\n/); +``` + +
+Examples + +```js +splitLines('This\nis a\nmultiline\nstring.\n'); // ['This', 'is a', 'multiline', 'string' , ''] +``` + +
+ + +[⬆ Back to top](#table-of-contents) + + ### toCamelCase Converts a string to camelcase. diff --git a/docs/index.html b/docs/index.html index 9fbd42386..240784560 100644 --- a/docs/index.html +++ b/docs/index.html @@ -244,6 +244,7 @@ repeatString reverseString sortCharactersInString +splitLines toCamelCase toKebabCase toSnakeCase @@ -1587,6 +1588,13 @@ Combine characters to get a string using join('').

sortCharactersInString('cabbage'); // 'aabbceg'
 
+

splitLines

+

Splits a multiline string into an array of lines.

+

Use String.split() and a regular expression to match line breaks and create an array.

+
const splitLines = str => str.split(/\r?\n/);
+
+
splitLines('This\nis a\nmultiline\nstring.\n'); // ['This', 'is a', 'multiline', 'string' , '']
+

toCamelCase

Converts a string to camelcase.

Break the string into words and combine them capitalizing the first letter of each word.