how to check if a string is alphabetic in javascript
function isLetter(str) {
return str.length === 1 && str.match(/[a-z]/i);
}function isAlphaOrParen(str) {
return /^[a-zA-Z()]+$/.test(str);
}
/*/^[a-zA-Z()]*$/ - also returns true for an empty string
/^[a-zA-Z()]$/ - only returns true for single characters.
/^[a-zA-Z() ]+$/ - also allows spaces*/
//better regEX to include question marks too
Also in JavaScript:
- javascript all type of data
- how to get file name in directory node js
- multiline comment in react
- javascript degree to radians
- npm react native turn by turn navigation
- get local time second javascript heure temps réel
- React Components
- jquery copier dans le presse papier
- get an html img tag from a string
- js scrolling in div
- Bind Json file into a Datagridview in windows form using C#
- js set datetime
- include partials ejs
- function to create an element javascript
- function redirect javascript
- javascript if statement
- array fill
- avoid compressing imagepicker react native
- base64 to blob
- nuxt vuetify google fonts
- show image javascript
- json minecraft
- .join in javascript
- lodash remove element from array