cn.jpush.api.report.ReportClient.checkMsgids C# (CSharp) Method

checkMsgids() public method

public checkMsgids ( String msgIds ) : String
msgIds String
return String
        public String checkMsgids(String msgIds)
        {
            if (string.IsNullOrEmpty(msgIds)) {
                throw new ArgumentException("msgIds param is required.");
            }
            Regex reg = new Regex(@"[^0-9, ]");
            if(reg.IsMatch(msgIds))
            {
                  throw new ArgumentException("msgIds param format is incorrect. "
                        + "It should be msg_id (number) which response from JPush Push API. "
                        + "If there are many, use ',' as interval. ");
            }
            msgIds = msgIds.Trim();
            if (msgIds.EndsWith(",")) {
                msgIds = msgIds.Substring(0, msgIds.Length - 1);
            }
            String[] splits = msgIds.Split(',');
            List<string> list = new List<string>();
            try {
                foreach (String s in splits) {
                    string trim = s.Trim();
                    if (!string.IsNullOrEmpty(trim))
                    {
                        long.Parse(trim);
                        list.Add(trim);
                    }
                }
                return StringUtil.arrayToString(list.ToArray());
            } catch (Exception) {
                throw new Exception("Every msg_id should be valid Integer number which splits by ','");
            }
        }