Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if string contains Latin characters only?

Tags:

javascript

How to check if a string contains [a-zA-Z] characters only?

Example:

var str = '123z56'; 
like image 525
PHP Noob Avatar asked Feb 08 '13 23:02

PHP Noob


People also ask

How do you check if a string contains letters JS?

Use the String. includes() method to check if a string contains a character, e.g. if (str. includes(char)) {} . The include() method will return true if the string contains the provided character, otherwise false is returned.

What is non Latin characters?

The MARC 21 Unicode standard currently supports the following non-Latin languages/scripts: Chinese, Japanese, Korean; Cyrillic-based scripts; Greek; Hebrew (e.g., Hebrew, Yiddish, Ladino, and Judeo-Arabic); and Perso-Arabic script (e.g., Arabic, Persian, Pushto, Sindhi, Urdu).

How do I check if a string contains text?

You can use contains(), indexOf() and lastIndexOf() method to check if one String contains another String in Java or not. If a String contains another String then it's known as a substring. The indexOf() method accepts a String and returns the starting position of the string if it exists, otherwise, it will return -1.

What are Latin characters in a password?

The standard Latin alphabet contains 26 letters, which means that there are (26*2)^8=5.346*10^13 8-letters, case-sensitive passwords. The Danish alphabet, as an example of Latin alphabet with additional characters, contains 29 letters, which means there are (29*2)^8=4.308*10^17 8-letters, case-sensitive passwords.


1 Answers

No jQuery Needed

if (str.match(/[a-z]/i)) {     // alphabet letters found } 
like image 162
jondavidjohn Avatar answered Oct 12 '22 17:10

jondavidjohn