using System;


namespace Day4

{

    class Program

    {

        static void Main(string[] args)

        {

            // 문자열에서 한 문자

            s = "Hello";

            char c = s[0];  // H

            c = s[1];       // e

            c = s[2];       // l

            Console.WriteLine(c);


            // 문자열 결합 (string concatenation)

            string s1 = "Hello";

            string s2 = "World";


            string s = s1 + " " + s2;

            Console.WriteLine(s);  // "Hello World"


            // 부분 문자열 (substring)

            string sub = s.Substring(1, 4);

            Console.WriteLine(sub);  // "ello"


            // 문자열에서 공백으로 분리

            s = "I am a boy";

            string[] words = s.Split(' ');


            for (int i = 0; i

            {

                Console.WriteLine(words[i]);

            }

        }

    }

}


씨샵 복습하는 중인데 csharpstudy 사이트에서 나오는 예문 그대로 들고 왔어

빨간색 s 해놓은 부분이 오류나는건데 [s 지역변수는 선언되지 않으면 사용할 수 없습니다]

이렇게 나오거든? string 하면 되겠거니 해서 하니까 이제는 밑의 string s랑 중복이 되더라

저 강의가 옛날 버전에서 작성한거라 그런가? 나는 지금 비쥬얼스튜디오 2019 사용하고 있어