package special;
public class IdentifySpecialChar {
public static void main(String[] args) {
try {
System.out.println(IdentifySpecialChar
.identifyingSpecialCharacters("Anil@"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static boolean identifyingSpecialCharacters(String value)
throws Exception {
boolean returnVal = false;
char[] charArray = value.toCharArray();
for (int i = 0; i < charArray.length; i++) {
System.out.println((int) charArray[i]);
if ((((int) charArray[i]) >= 32 && ((int) charArray[i]) <= 47)
|| (((int) charArray[i]) >= 58 && ((int) charArray[i]) <= 64)
|| (((int) charArray[i]) >= 91 && ((int) charArray[i]) <= 96)
|| (((int) charArray[i]) >= 123 && ((int) charArray[i]) <= 127)) {
returnVal = true;
break;
}
}
return returnVal;
}
}
public class IdentifySpecialChar {
public static void main(String[] args) {
try {
System.out.println(IdentifySpecialChar
.identifyingSpecialCharacters("Anil@"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static boolean identifyingSpecialCharacters(String value)
throws Exception {
boolean returnVal = false;
char[] charArray = value.toCharArray();
for (int i = 0; i < charArray.length; i++) {
System.out.println((int) charArray[i]);
if ((((int) charArray[i]) >= 32 && ((int) charArray[i]) <= 47)
|| (((int) charArray[i]) >= 58 && ((int) charArray[i]) <= 64)
|| (((int) charArray[i]) >= 91 && ((int) charArray[i]) <= 96)
|| (((int) charArray[i]) >= 123 && ((int) charArray[i]) <= 127)) {
returnVal = true;
break;
}
}
return returnVal;
}
}
No comments:
Post a Comment