Java文字列charAt
length

charAt文字列

substring

指定したインデックスの文字を返します。

構文

str.charAt(index)

使用例

下記の値を入力するとサンプルに即時反映されます。

String
System
out
println
charAt
String s = "Hello";
System.out.println(s.charAt(0));  // 'H'
System.out.println(s.charAt(4));  // 'o'