isUpperCase
This commit is contained in:
17
snippets/isLowerCase.md
Normal file
17
snippets/isLowerCase.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
### isLowerCase
|
||||||
|
|
||||||
|
Checks if the provided argument contains anything else than the lowerCase alphabets. If the second argument is provided to be true than numbers and other symbols are considered lowercase too.
|
||||||
|
|
||||||
|
``` js
|
||||||
|
const isLowerCase = (val,symbol = false) => {
|
||||||
|
if (symbol) return val === val.toLowerCase()
|
||||||
|
else return !(/[^a-z]/g.test(val))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
```js
|
||||||
|
isUpperCase('abc'); //true
|
||||||
|
isUpperCase('abc123@$'); //false
|
||||||
|
isUpperCase('abc123@$',true); //true
|
||||||
|
isUpperCase('abc123@$ABCD',true); //false
|
||||||
|
isUpperCase('abc123@$ABCD'); //false
|
||||||
|
```
|
||||||
16
snippets/isUpperCase.md
Normal file
16
snippets/isUpperCase.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
### isUpperCase
|
||||||
|
|
||||||
|
Checks if the provided argument contains anything else than the upperCase alphabets. If the second argument is provided to be true than numbers and other symbols are considered uppercase too.
|
||||||
|
``` js
|
||||||
|
const isUpperCase = (val,symbol = false) => {
|
||||||
|
if (symbol) return val === val.toUpperCase()
|
||||||
|
else return!(/[^A-Z]/g.test(val))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
``` js
|
||||||
|
isUpperCase('ABC'); //true
|
||||||
|
isUpperCase('ABC123@$'); //false
|
||||||
|
isUpperCase('ABC123@$',true); //true
|
||||||
|
isUpperCase('ABC123@$abcd',true); //false
|
||||||
|
isUpperCase('ABC123@$abcd'); //false
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user