Programing(프로그래밍)
C# 어딘가에 있을 대문자를 찾자
라고
2015. 8. 5. 17:54
지금은 새벽 2시...
비독님의 아이디어(?)를 받아 간단한 프로그램 하나 만들었다. 만들다보니 잼나넹 허허..
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | using System; using System.Collections.Generic; using System.IO; namespace test { class Program { public static List<string> Names = new List<string>(); public static void LoadAndCheckFromFile() { StreamReader loadfile = new StreamReader(@"C:\temp\temp.txt"); while (loadfile.Peek() >= 0) { string name = loadfile.ReadLine(); char[] namespilt = name.ToCharArray(); string newname = ""; int count = 0; foreach (char letter in namespilt) { if ((int)letter > 64 && (int)letter < 91) { count++; } } if(count >0) { newname = "!" + name; } else { newname = name; } Names.Add(newname); } loadfile.Close(); } public static void SaveToFile() { StreamWriter savefile = new StreamWriter(@"C:\temp\temp.txt"); foreach (string s in Names) { savefile.WriteLine(s); } savefile.Close(); } static void Main(string[] args) { LoadAndCheckFromFile(); SaveToFile(); } } } | cs |
근데 어떤분이 엑셀에서 할 수 있는 해결법을 주셨는데
이걸보니 사람은 정말 똑똑해야 하는구나를 느꼈다....
멍청하면 손발이 고생함 ㅠㅠ