You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
881 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExtensionMethod
{
// static 클래스 선언 필요
public static class ExClass
{
public static string ToChangeCase(this string str)
{
StringBuilder sb = new StringBuilder();
foreach (char ch in str)
{
if (ch >= 'A' && ch <= 'Z')
sb.Append((char)('a' + ch - 'A'));
else if (ch >= 'a' && ch <= 'z')
sb.Append((char)('A' + ch - 'a'));
else
sb.Append(ch);
}
return sb.ToString();
}
public static bool Found(this string str, char ch)
{
int position = str.IndexOf(ch);
return position >= 0;
}
}
}