using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Study11
{
class App
{
string[] arr;
//생성자
public App()
{
string[] arr = {
"powdered Toast Man",
"skeletor",
"Electra Woman and Dyna Girl",
"she-Ra Princess of Power",
"darth Vader"
};
this.arr = arr;
for (int i = 0; i < arr.Length; i++)
{
Count(i);
}
}
void Count(int a)
{
char[] ch = arr[a].ToCharArray(); //a에 들어가는 인덱스의 문자를 출력해주는 메서드인 듯 하다.
char afterCh = Char.ToUpper(ch[0]); //대문자로 바꿔주는 메서드 //0인덱스만 대문자로 바뀐다.
Console.Write(afterCh);
for (int i = 0; i < ch.Length - 1; i++) //-1을 하는 이유는 총 인덱스 길이에서 1을 빼야하기 때문
{
Console.Write(ch[i + 1]);
}
Console.WriteLine();
}
//출력
//Powdered Toast Man
//Skeletor
//Electra Woman and Dyna Girl
//She - Ra Princess of Power
//Darth Vader
}
}
ToCharArray 메서드 유용한 듯
이현민님 블로그 참고
'Algorithm > BOJ' 카테고리의 다른 글
[BOJ] 1120 문자열(미완) (0) | 2023.01.13 |
---|---|
[BOJ] 10173 니모를 찾아서 (0) | 2023.01.12 |
[BOJ] 2711 오타맨 고창영 (0) | 2023.01.12 |
[BOJ] 9086 문자열 (0) | 2023.01.12 |
[BOJ] 9012 괄호 (0) | 2023.01.11 |