String str = "12.3|45.6|78.9";

String[] arr = str.split("\\|");


for(int i=0; i<arr.length; i++) {

Log.i("split test", arr[i]);

}


\\붙이지 않은 경우

1

2

.

3

4

5

.

6

7

8

.

9


\\붙인 경우

12.3

45.6

78.9


\\를 붙이지 않으면 한글자씩 인식 되기 때문에 특수문자를 구분자로 할 경우 \\를 붙여야 됨. 



개발 중 발생한 오류 및 해결 방법 정리



2017-06-30

- 상황 : 안드로이드 스튜디오 버전업 후 기존 프로젝드 Run 했을때 아래와 같은 오류 발생

- 오류 : This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest version)

- 해결 : Build > Clean Project





'개발 > ANDROID' 카테고리의 다른 글

안드로이드 SDK 21 이상 http 링크 호출  (0) 2019.04.26
split 로 문자열 자를때 유의사항  (0) 2017.07.03

DECLARE @str varchar(20), @split varchar(1)


SET @str = '동해물과/백두산이'

SET @split = '/'


-- 구분자 앞 문자열 보여주기

print LEFT(@str, CHARINDEX(@split, @str) - 1)

-- 결과 : 동해물과


-- 구분자 뒤 문자열 보여주기

print RIGHT(@str, CHARINDEX(@split, REVERSE(@str)) - 1)

-- 결과 : 백두산이

+ Recent posts