Android Studio
(Android Studio) StringBuffer 사용방법 + 메소드로 특정 위치에 추가하기
SAFE
2016. 5. 2. 10:53
출처 : http://aroundck.tistory.com/11
StringBuilder / StringBuffer (보안 높고 속도 조금 느림)
StringBuilder sb = new StringBuilder( "CK " );
sb.append( "lives in " );
sb.append( "Seoul ");
======================
출처 : http://tip.daum.net/openknow/59160290
StringBuffer insert 메소드로 특정 위치에 추가하기
public static void main(String[] args) {
StringBuffer sb = new StringBuffer("abc");
System.out.println(sb);
sb.insert(0, "A");
System.out.println(sb);
sb.insert(2, "B");
System.out.println(sb);
}
출력 결과는 아래와 같습니다.
abc
Aabc
AaBbc
============================
삭제한 문자열 반환
출처 : http://hyeonstorage.tistory.com/179
엄청 자세한 설명들이 있다.
StringBuffer deleteCharAt(int index)
index 위치의 문자 중 삭제한 문자열을 반환 한다.