How to know if a character is a half-width character or a full-width character ?
Application Type
Traditional Web

Hello everyone,

How to know if  input string is half-width or full-width ?

Regards,


Hi Mai,

You can use below javascript to find the given input character is a half-width character or a full-width character 

str="Chinese;;A"
alert(str.match(/[\u0000-\u00ff]/g)) //Half-width
alert(str.match(/[\u4e00-\u9fa5]/g)) //Chinese
alert(str.match(/[\uff00-\uffff]/g)) //full width

Thanks, Aadhavan S

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.