반응형
- Substring
string myString = "Hello World!";
string subString = myString.Substring(6, 5);
Debug.Log(subString); // Output: "World"
- Split
string myString = "Hello, World!";
string[] substrings = myString.Split(',');
// Output: "Hello", " World!"
- Replace
string myString = "Hello World!";
string replacedString = myString.Replace("Hello", "Hi");
Debug.Log(replacedString); // Output: "Hi World!"
- IndexOf
string myString = "Hello World!";
int index = myString.IndexOf("World");
Debug.Log(index); // Output: 6
- Trim
string myString = " Hello, World! ";
string[] substrings = myString.Trim().Replace(",", "").Split(' ');
// Output: "Hello", "World!"
반응형
'개발 > C#' 카테고리의 다른 글
유니티 C# 날짜 비교하기 DateTime.Compare (0) | 2023.03.29 |
---|---|
유니티 C# 다음주 월요일 알아내는 간단 방법 DayOfWeek (0) | 2023.03.27 |
유니티 C# 절대값 구하기 Mathf.Abs 또는 삼항 연산자 간단 구현 (0) | 2023.03.27 |
유니티 C# 팩토리얼 factorial 간단 사용법 (0) | 2023.03.26 |
유니티 C# UI끼리 겹쳤을 때 체크하는 법 Unity UI Overlap (0) | 2023.03.22 |
유니티 C# 2D 물리 점프 간단 구현 Unity Rigidbody2D Jump (0) | 2023.03.22 |
유니티 C# 룰렛 만들기 간단 구현 Unity Roulette (0) | 2023.03.22 |
유니티 C# 플레이어를 추적하는 적 코드 간단 구현 Unity (0) | 2023.03.19 |
댓글