[Solved] convert char to string in loop in java and then Set it to JtextField

[ad_1]

Your code already extracts the first letter of each word. For the rest of you question it’s quite simple. Put the letters into a variable and set the text of a different textfield.

public void auto() {  
    String result = "";
    String x = jTextField1.getText().toUpperCase();  
    String[] myName = x.split(" ");  
    for (int i = 0; i < myName.length; i++) {  
        String s = myName[i];
        result += s.charAt(0);
    }
    jDifferentTextField.setText(result);
}

3

[ad_2]

solved convert char to string in loop in java and then Set it to JtextField