197 views
in GUI Development by
Hi,

    i have string value with alphanumeric [ XYZ001]

   it is not accept the special character so how i add validation

var string input= "XYZ001";

Input.find( aChar, aStartIndex );  //this implemention is correct

how we filter the special character from input string.please help me to resolve this.

 

With Regards,

Ramesh.g

1 Answer

0 votes
by

Hello Ramesh.g,

I assume the string has been entered by the user and you want to verify whether the string content is correct. In such case you would implement a loop to iterate through the string characters and test character by character whether it corresponds to the expected syntax. For example, if the string is allowed to store ascii characters A-Z and digits 0-9, following could be the implementation:

var string text  = .... // your string
var int32  len   = text.length;
var bool   valid = len > 0;
var int32  inx;

for ( inx = 0; ( inx < len ) && valid; inx = inx + 1 )
  if ((( text[inx] < 'A' ) || ( text[inx] > 'Z' )) &&
      (( text[inx] < '0' ) || ( text[inx] > '9' )))
    valid = false;

if ( !valid )
  trace "The text is not valid";

I hope it helps you further.

Best regards

Paul Banach

by
Hi Paul,

Thanks for the quick update .It is working fine.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...