Пример #1
0
        /// <summary>
        /// 将 ip 地址转换成 string
        /// </summary>
        public static string LongToIP(this long ip)
        {
            StringBuilder sb = TmpValueHelper.GetStringBuilder();

            sb.Append(ip & 0xFF).Append(".");
            sb.Append((ip >> 8) & 0xFF).Append(".");
            sb.Append((ip >> 16) & 0xFF).Append(".");
            sb.Append((ip >> 24) & 0xFF);
            return(sb.ToString());
        }
Пример #2
0
        /// <summary>
        /// 将数组转化为字符串,并用 sliptChar 分割
        /// </summary>
        public static string ArrayToString <T> (this T[] array, char splitChar = '#')
        {
            if (array == null)
            {
                return(string.Empty);
            }

            StringBuilder ret = TmpValueHelper.GetStringBuilder();

            array.ValueForeach(item => ret.Append(item.ToString()).Append(splitChar));
            return(ret.ToString().TrimEnd(splitChar));
        }