Example #1
0
File: Json.cs Project: zjbsean/TM
        public static TIntList Json2TIntList(string jsonStr)
        {
            TIntList result = null;

            if (jsonStr.Length < 3)
            {
                return(null);
            }

            jsonStr = jsonStr.Substring(1, jsonStr.Length - 2);
            string[] valArray = jsonStr.Split(',');
            for (int i = 0; i < valArray.Length; i++)
            {
                string valItem = valArray[i].Trim();
                if (valItem == string.Empty)
                {
                    continue;
                }

                if (result == null)
                {
                    result = new TIntList();
                }

                result.Add(Convert.ToInt32(valItem));
            }

            return(result);
        }
Example #2
0
        public static string TIntList2Str(TIntList intList, char split)
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < intList.GetElements().Count; i++)
            {
                sb.Append(intList.GetElements()[i]);
                if (i != intList.GetElements().Count - 1)
                {
                    sb.Append(split);
                }
            }

            return(sb.ToString());
        }
Example #3
0
        public static TIntList Str2TIntList(string str, char split)
        {
            string[] strArray = str.Split(split);
            TIntList list     = new TIntList();

            foreach (var item in strArray)
            {
                if (item == string.Empty)
                {
                    continue;
                }

                list.Add(Convert.ToInt32(item));
            }
            return(list);
        }
Example #4
0
 public EntityIterable(PojoEntityManager outerInstance, TIntList list)
 {
     this.outerInstance = outerInstance;
     this.list          = list;
 }