How to write Validation to allow only ASCII ( 32 to127) Characters in text field

Hi,

Validation input for text field.

I have a requirement to allow only ASCII ENGLISH Characters(32 to 127) in the text field. From ASCII 32 to ASCII 127 only. Other ASCII Characters 0 to 31 and 128 to 255 ( Foregin characters) should not be allowed.

ASCII Code - The extended ASCII table (ascii-code.com)

ASCII ( 32 to 127) = limited to english character set, numbers, space and general symbols.

how to achieve this ?

Could you Please help with the Java Code in edit validate. or any other logic to achieve this

@JANAKIRAMA one option is to use a Edit Validate , sample code below

for (int pos = 0, len = theValue.length(); pos < len; ++pos) {
  char c = theValue.charAt(pos);
  int ascii = (int)c;
	if (ascii<32 || ascii>127)
        		return false;
}
return true;

@KAUSTAV.DUTTA

Thank you for the solution, its worked

Great, appreciate it.