Check if string is a punctuation character
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"); } } Karthik T Do you want to check more punctuations other than just . ? If so you can do this. String punctuations = ".