Hello,

I have a string taken as input from user. I just want to check if a particular character within that string, is part of Standard English character set or not.

How do I code the IF condition for this purpose?

Regards,
Arvind.

Recommended Answers

All 4 Replies

Forget if use for loop. Put all characters you want to check upon in a List, then with help of for loop go through word and check if List contains() that character.

Another way to check a single char.
Make it a String and use indexOf with a long String containing all the valid characters.

Do you mean a-z, A-Z ? If so, just check char between 'a' and 'z' OR between 'A' and 'Z'.

using .charAt(position ); you will get the i character in the String .

about checking is std English character you can check simply if the character fall between 'a' and 'z'

char c='a';
        if (c>='a'&&c<='z')
            System.out.println("Valid");
        else
            System.out.println("not Valid");

i hope i helped .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.