티스토리 뷰
문자열 자르기 - Split
String a = "a,b,c,d,e";
String[] arr = a.split(",");
System.out.println(Arrays.toString(arr));
[a, b, c, d, e]
특정문자 제거하기 - replace
a = a.replace("{","").replace("}","");
맨 앞의 요소 제거하기 - substring
if(a.startsWith(",")) {
a = a.substring(1);
}
String to Int
String s = "123";
int StringToInt = Integer.parseInt(a);
Int to String
int i = 123;
String IntToString = Integer.toString(i);
String index로 접근하기 - charAt
String a = "abcde";
System.out.println(a.charAt(1));
//b
int at1 = a.charAt(1);
System.out.println(at1);
//98
String at2 = a.charAt(1) + "";
System.out.println(at2);
//b
추출한 값을 int에 넣어주면 아스키값 출력
반응형
'자바' 카테고리의 다른 글
[java]Int와 Integer (0) | 2021.06.22 |
---|---|
[JAVA]not dereferenced error (0) | 2021.06.22 |
[JAVA]배열 다루기 (0) | 2021.06.20 |
[JAVA]스택 사용 (0) | 2021.06.20 |
JAVA 배열선언 및 출력 (0) | 2021.05.27 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Xcode
- SWiFT
- main branch
- 애플 인증
- 애플 인증서
- closure
- Widget
- New Group Without Folder
- New Group
- 백준 1065번 swift
- 이분탐색
- 백준알고리즘
- mvvm in swiftui
- 파이썬
- palera1n
- 백준
- provisioning key
- sileo
- ios
- 백준 4673 swift
- 장고
- readme ignore파일 포함한 repository
- django
- xcuserdata
- 프로퍼티 래퍼
- ios mvvm
- 클로저
- 알고리즘
- property wrapper
- xcsharedata
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함