Resolves #16
This commit is contained in:
@ -86,9 +86,11 @@ var capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCas
|
||||
### Capitalize first letter
|
||||
|
||||
Use `slice(0,1)` and `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string.
|
||||
Omit the `lowerRest` parameter to keep the rest of the string intact, or set it to `true` to convert to lower case.
|
||||
|
||||
```js
|
||||
const capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1);
|
||||
const capitalize = (str, lowerRest = false) =>
|
||||
str.slice(0, 1).toUpperCase() + (lowerRest? str.slice(1).toLowerCase() : str.slice(1));
|
||||
```
|
||||
|
||||
### Count occurrences of a value in array
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
### Capitalize first letter
|
||||
|
||||
Use `slice(0,1)` and `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string.
|
||||
Omit the `lowerRest` parameter to keep the rest of the string intact, or set it to `true` to convert to lower case.
|
||||
|
||||
```js
|
||||
const capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1);
|
||||
const capitalize = (str, lowerRest = false) =>
|
||||
str.slice(0, 1).toUpperCase() + (lowerRest? str.slice(1).toLowerCase() : str.slice(1));
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user