substring (문자 추출)

han.user();·2023년 3월 4일
0
post-thumbnail

substring 문자를 추출, 위치를 알려줘야함

String s7 = "bye! World!";
System.out.println(s7.substring(0, 3)); //0부터 3의 앞자리까지라는 뜻(0,1,2)
System.out.println(s7.substring(0, s7.indexOf("!")+1)); // 앞자리까지니까 +1
profile
I'm still hungry.

0개의 댓글