CgwMonitorManage.Common.CommonFunction.ConvertChannelLabel C# (CSharp) Method

ConvertChannelLabel() public static method

将code@ip的通道标识中code提取出来
public static ConvertChannelLabel ( string channelLabel ) : string
channelLabel string 通道标识
return string
        public static string ConvertChannelLabel(string channelLabel)
        {
            // 判断输入通道号码是否为空
            if (string.IsNullOrEmpty(channelLabel))
            {
                return string.Empty;
            }

            // 如果channelLabel没有@,原字符串返回
            bool isFind = channelLabel.Contains("@");
            if (!isFind)
            {
                return channelLabel;
            }

            // 通过@将通道标识分成几段
            string[] strArray = channelLabel.Split(new string[] { "@" }, StringSplitOptions.None);
            if (null == strArray || null == strArray[0])
            {
                return string.Empty;
            }

            return strArray[0];
        }