如题:

解决方案 »

  1.   

    貌似string.StartsWith()方法   string s = "400,800,1fdasdfasfas2423vcsa";
        bool isTrue=s.StartsWith("400,800,1");
      

  2.   

    string的 StartsWith 判断,或者
    正则Regex reg = new Regex(@"^(800|400|1).*");
      

  3.   

    如果你是想判断一个字符串以800或者400或者1开头的话,可以写一个扩展方法:    public static class Ext
        {
            public static bool StartsWith(this string s, params string[] prefix)
            {
                return prefix.Any(p => s.StartsWith(p));
            }
        }
        //用法:
        bool result = s.StartsWith("1", "400", "800", "30"); //是否以1或者400或者800或者30开头
      

  4.   


    prefix.Any()是什么意思?
      

  5.   

    Loop:
    接收 
    拆解
    操作
    组合
    发送
      

  6.   

    string str = "400526398|800046846|12365478965|33444425";
    string[] arr = str.Split('|');
    if (arr[0].StartsWith("400") && arr[1].StartsWith("800") && arr[2].StartsWith("1"))
    {
        arr[3] = "110" + arr[3];
        string result = string.Join("|", arr);
    }