String的细节

【String的细节】It comes from a problem from LeetCode Portal
String s
i use the clause that s[i] to get the ith letter in string s. Surely, it's wrong.


Because the expression of s[i]means that the s is an array. However, it's a string.
we can use the below function.

  • s.charAt(int index)
  • char[] arr = s.toCharArray()

    推荐阅读