Quick question
in
Programming Questions
•
1 year ago
Hi.
I am trying to simply count all the letters for a user input string but don't want any 'spaces' to be included in the count, just the letters.
Is this possible using length() ?
Thanks for any help!
I am trying to simply count all the letters for a user input string but don't want any 'spaces' to be included in the count, just the letters.
Is this possible using length() ?
Thanks for any help!
- import javax.swing.JOptionPane;
String s;
void setup() {
size(1000,400);
background(255);
fill(0);
smooth();
textAlign(CENTER);
textSize(18);
s = JOptionPane.showInputDialog("Enter a word or sentence");
}
void draw() {
text("There are "+s.length()+ " letters in your word or sentence.", width/2, 80); // length of string.
}
1