string str="oh?my?god";
int pos=str.LastIndexOf('?');
string str1=str.Substring(pos);

解决方案 »

  1.   

    substring 只是为了截取字符串
      

  2.   

    string str="oh?my?god";
    string substr[]=str.Split(new Char[]{'?'},1);
      

  3.   

    我试过了string .lastIndexof,但是怎么返回的是0xffffff
      

  4.   

    我的目的只是为了在一个字符串中搜索有没有字串存在,象c++中有strspn()函数,不知道C#中有没有对应的函数
      

  5.   

    那你可以用string.index("子串"),如果返回的“-1”则没有该子串。