[Java] - String.toCharArray() 사용법

uHan2·2020년 11월 11일
4

TIL.Algorithm

목록 보기
5/12

안녕하세요.
지금까지 계속 저만의 기술 블로그를 만들어야지, 만들거야
마음으로만 다짐하다가 인제야 시작하게 되었습니다.
비록 시작은 코딩일기지만, 그 끝은 창대하게
어엿한 개발자 블로그로 성장할 수 있도록 노력하겠습니다.


String.toCharArray()

는 문자열을 한 글자씩 쪼개서
이를 char타입의 배열에 집어넣어주는 친절한 메소드이다.

  • String(문자열)char형 배열로 바꾼다.
  //how to use method
  String s1 = "Hello World";
  char[] charArr = s1.toCharArray();
  • 추가로, char형 배열을 합쳐서 하나의 String(문자열)로 만들 수 있다.
  //how to use method
  String s2 = new String(charArr);
profile
For the 1% inspiration.

1개의 댓글

comment-user-thumbnail
2023년 4월 3일

Finally, quilties need headphones that are comfortable to wear for long periods of time. This means that the headphones should have excellent build quality and an ergonomic design that is comfortable for long hours of studio time. Additionally, the headphones should be lightweight and have a good seal, so that quilties can comfortably wear the headphones for extended periods of time. https://headphonester.com/best-open-back-headphones/

답글 달기