charAt() or substring? Which is faster?

后端 未结 6 2378
天命终不由人
天命终不由人 2020-12-15 10:07

I want to go through each character in a String and pass each character of the String as a String to another function.

String s = \"abcdefg\";
for(int i = 0         


        
6条回答
  •  轮回少年
    2020-12-15 10:42

    The answer is: it doesn't matter.

    Profile your code. Is this your bottleneck?

提交回复
热议问题