Let's say I have a String array that contains some letters and punctuation
String letter[] = {"a","b","c",".","a"};
In letter[3] we have "."
How can I check if a string is a punctuation character?
We know that there are many possible punctuation characters (,.?! etc.)
My progress so far:
for (int a = 0; a < letter.length; a++) {
if (letter[a].equals(".")) { //===>> i'm confused in this line
System.out.println ("it's punctuation");
} else {
System.out.println ("just letter");
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…