728x90
1. 추가하기(add)
public List<String> ListString;
ListString.add("추가할 문자열");
2. 제거하기(Remove, RemoveAt, RemoveRange)
public List<String> ListString;
ListString.Remove("삭제 할 문자열"); // 값을 가지고 있는 것 찾아서 삭제
ListString.RemoveAt(0); // 인덱스 값으로 삭제
ListString.RemoveRange(index, count); // index부터 Count의 수 만큼 삭제
ListString.RemoveRange(0,3); // 0부터 3개 삭제
3. 초기화하기()
public List<String> ListString;
ListString.add("추가할 문자열");
4. 문자열 찾기(Contains)
public List<String> ListString;
ListString.Contains("확인할 문자열"); // true, false 반환
5. 문자열에 인덱스 번호 출력(IndexOf)
public List<String> ListString;
Debug.Log(ListString.IndexOf("인텍스 번호 출력할 문자열")); // 1 출력 (없으면 -1 출력)
728x90
반응형
'소프트웨어 개발 > 유니티(Unity)' 카테고리의 다른 글
[Unity] 클릭한 오브젝트(버튼)의 이름 가져오기 (0) | 2021.11.30 |
---|---|
[Unity] '' is an incorrect path for a scene file. BuildPlayer expects paths relative to the project folder. 오류 해결방법! (0) | 2021.11.09 |
[Unity] 문자열 역순으로 출력 (0) | 2021.08.17 |
[Unity] Json에 저장된 한글 깨짐 현상 (0) | 2021.07.30 |
[Unity] 유니티 단축키 모음 (0) | 2021.07.26 |
댓글