CODEKILLER

반응형

String.Remove
String.Remove

public class Example
{
    public static void Main()
    {
        string source = "I am stronger than Batman.";
        string toRemove = "stronger ";
        string result = string.Empty;
        int i = source.IndexOf(toRemove);
        if (i >= 0)
        {
            result = source.Remove(i, toRemove.Length);
        }
        Console.WriteLine(source);
        Console.WriteLine(result);
    }
}
반응형

공유하기

facebook twitter kakaoTalk kakaostory naver band