检查a字符串是否在b字符串中存在,如果存在,在b字符串中删除字符串a?小问题,解决结分,谢谢!

解决方案 »

  1.   

    string ss="dsf" ;
    string ddd= "dsfsdf" ;
    if(ddd.IndexOf(ss) != -1)
    {
    ddd=ddd.Replace(ss,"") ;
    }
      

  2.   

    string a;
    string b;
    if(b.IndexOf(a))
    {
    b.Remove(b.IndexOf(a),b.Length);
    }
      

  3.   

    string a;
    string b;
    if(b.IndexOf(a))
    {
    b.Remove(b.IndexOf(a),a.Length);
    }
      

  4.   

    '區分大小寫
    If b.IndexOf(a)<>-1 Then
      b=b.Replace(a,"")
    End If
      

  5.   

    '區分大小寫
    If b.IndexOf(a)<>-1 Then
      b=b.Replace(a,"")
    End If
      

  6.   

    using System.Text.RegularExpressions;string Text=@"bbbabbbbb";
    string Pattern=@"a";
    string Replace=@"";
    string Matches=Regex.Replace(Text,Pattern,Replace);