Skip to content

Instantly share code, notes, and snippets.

@Togami-Arahi
Created April 2, 2015 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Togami-Arahi/029c89f1dcb6dffe0a50 to your computer and use it in GitHub Desktop.
Save Togami-Arahi/029c89f1dcb6dffe0a50 to your computer and use it in GitHub Desktop.
// http://www.javadrive.jp/start/string/index5.htmlからコピペ
class CharAt{ //JSample5_1をCharAtに改変
public static void main(String args[]){
String str = "パタトクカシーー"; //腕時計をパタトクカシーーに改変
char c1 = str.charAt(0);
char c3 = str.charAt(2);
char c5 = str.charAt(4);
char c7 = str.charAt(6); //一つ追加
// http://www.techscore.com/blog/2012/11/29/%E6%96%87%E5%AD%97%E5%88%97%E7%B5%90%E5%90%88-java%E7%B7%A8/からコピペ改変
StringBuilder buf = new StringBuilder();
buf.append(c1);
buf.append(c3);
buf.append(c5);
buf.append(c7);
String c = buf.toString();
System.out.println(c);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment