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
Hello Sazna,
following could be an example demonstrating such evaluation. The string specialChars has to be adapted to your needs, depending on what you mean with special chars:
var string specialChars = "+*#,;.:-_!ยง%%$$/()[]"; var string text = "Some Text 7 +"; var int32 len = text.length; var bool hasLowerCase = false; var bool hasUpperCase = false; var bool hasDigitSign = false; var bool hasSpecialChar = false; var int32 inx; for ( inx = 0; ( inx < len ); inx = inx + 1 ) { var char c = text[inx]; hasLowerCase |= ( c >= 'a' ) && ( c <= 'z' ); hasUpperCase |= ( c >= 'A' ) && ( c <= 'Z' ); hasDigitSign |= ( c >= '0' ) && ( c <= '9' ); hasSpecialChar |= specialChars.find( c, 0 ) >= 0; } var bool valid = hasLowerCase && hasUpperCase && hasDigitSign && hasSpecialChar;
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