반응형
String 메서드 알아보러 가기
C# - String (찾기, 변형, 분할, 제거 메서드)
1. 찾기 01 Contains 특정 문자열이 문자열안에 있는지 확인 public bool Contains (string value); 반환 Boolean : 문자열이 있으면 true 없으면 false 를 반환한다. string name = "Pink Pig"; bool found = name.Contains("Pink"); Con
code-piggy.tistory.com
using System;
namespace baek2
{
class Program
{
static void Main(string[] args)
{
string input = Console.ReadLine();
string trim_input = input.Trim();
string[] token = trim_input.Split();
if (String.IsNullOrEmpty(token[0]))
{
Console.WriteLine(0);
}
else
{
Console.WriteLine(token.Length);
}
}
}
}
반응형
'코딩테스트 준비 > 백준 C#' 카테고리의 다른 글
백준 C# 5622 (0) | 2023.04.26 |
---|---|
백준 C# 2908 (0) | 2023.04.26 |
백준 C# 10809 (0) | 2023.04.26 |
백준 C# 11720 (0) | 2023.04.26 |
백준 C# 11654 (0) | 2023.04.26 |
댓글