What is the best way to repeat a string in Java?

Asked 1 years ago, Updated 1 years ago, 100 views

Is there any other way to change the string to char[] by turning the repetitive statement instead of StringTokenizer?

string java tokenize iteration character

2022-09-22 22:18

1 Answers

You can use charAt() inside the repeating sentence.

String s = "...stuff...";

for (int i = 0; i < s.length(); i++){
    char c = s.charAt(i);        
}

This is the simplest way I think.


2022-09-22 22:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.