C#/C# Training
[C#] 문자열 함수
군우
2018. 5. 17. 10:51
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 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication9 { class StringTest2 { static void Main(string[] args) { string str = "Hello Wourld Hi Hello"; Console.WriteLine("원문 str: {0}", str); Console.WriteLine(); Console.WriteLine("Index of \"World\": {0}", str.IndexOf("World")); Console.WriteLine("LastIndexOf \"Hi\": {0}", str.LastIndexOf("World")); Console.WriteLine("Replace\"World\" to \"Tom\" :{0}", str.Replace("World","Tom")); Console.WriteLine("str의 substring(6): {0} ", str.Substring(6)); } } } | cs |