/// <summary> /// 得到字符串长度,一个汉字长度为2 /// </summary> /// <param name="input">要处理的字符串</param> /// <returns></returns> public static int GetLength(this string input) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.GetStrLength(header, input)); }
/// <summary> /// 是否ip地址 /// </summary> /// <param name="input"></param> /// <returns></returns> public static bool IsIpAddress(this string input) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsIpAddress(header, input)); }
/// <summary> /// 是否与指定正则表达式匹配 /// </summary> /// <param name="input">要匹配的内容</param> /// <param name="pattern">正则表达式字符串</param> /// <param name="options">正则表达式选项</param> /// <returns></returns> public static bool IsMatch(this string input, string pattern, int options = 0) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsMatch(header, input, pattern, options)); }
/// <summary> /// 是否汉字 /// </summary> /// <param name="input"></param> /// <returns></returns> public static bool IsChineseCharacter(this string input) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsChineseCharacter(header, input)); }
/// <summary> /// 将含有指定字符的字符串转成以该字符分割的字符串列表 /// </summary> /// <param name="splitStr">有分割字符的字符串</param> /// <param name="spliter">分割字符</param> /// <param name="isDistinct">是否去除重复</param> /// <returns>List</returns> public static List <string> ToStrList(this string splitStr, char spliter, bool isDistinct = false) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.GetStringListBySplitStr(header, splitStr, spliter, isDistinct).ToList()); }
/// <summary> /// 转半角 /// </summary> /// <param name="input">输入字符串</param> /// <returns></returns> public static string ToHalfWidthStr(this string input) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.ToHalfWidthStr(header, input)); }
/// <summary> /// 获取加密后的字符串 /// </summary> /// <param name="password">需要加密的字符串</param> /// <param name="encodingStr">编码字符串(全小写)</param> /// <returns></returns> public static string ToPasswordStr(this string password, string encodingStr = "utf8") { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.GetEncryptStrResult(header, password, encodingStr)); }
/// <summary> /// 非零负整数 /// </summary> /// <param name="input"></param> /// <returns></returns> public static bool IsNonZeroNegativeInteger(this string input) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsNonZeroNegativeInteger(header, input)); }
/// <summary> /// 是否指定长度的数字 /// </summary> /// <param name="input"></param> /// <param name="length"></param> /// <returns></returns> public static bool IsSpecifiedLengthNumStr(this string input, int length) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsSpecifiedLengthNumStr(header, input, length)); }
/// <summary> /// 只能输入指定范围长度的数字 /// </summary> /// <param name="numStr"></param> /// <param name="min"></param> /// <param name="max"></param> /// <returns></returns> public static bool ValidateNumBetweenLength(this string numStr, int min, int max) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsBetweenLengthNum(header, numStr, min, max)); }
/// <summary> /// 只能输入有1~3位小数的正实数 /// </summary> /// <param name="input"></param> /// <returns></returns> public static bool IsPositiveRealNumWithOneToThreeDecimalPlaces(this string input) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsPositiveRealNumWithZeroToThreeDecimalPlaces(header, input)); }
/// <summary> /// 输入至少指定位数的数字 /// </summary> /// <param name="numStr"></param> /// <param name="minLength"></param> /// <returns></returns> public static bool ValidateNumMin(this string numStr, int minLength) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsMinimumLengthNum(header, numStr, minLength)); }
/// <summary> /// 只能输入数字 /// </summary> /// <param name="numStr"></param> /// <returns></returns> public static bool ValidateNum(this string numStr) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsNum(header, numStr)); }
/// <summary> /// 获取使用加盐Md5加密的字符串 /// </summary> /// <param name="pwd">要加密的字符串</param> /// <param name="salt">盐</param> /// <returns></returns> public static string ToMd5SaltPwdStr(this string pwd, string salt) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.GetMd5SaltStrResult(header, pwd, salt)); }
/// <summary> /// 按指定的长度截取字符串 /// </summary> /// <param name="input">要截取的字符串</param> /// <param name="length">要截取的长度</param> /// <param name="fixStr">截取后填充的字符</param> /// <returns></returns> public static string GetSubStrByLength(this string input, int length, string fixStr = "...") { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.GetSubStrByLength(header, input, length, fixStr)); }
/// <summary> /// 是否数字、字母和下划线 /// </summary> /// <param name="input"></param> /// <returns></returns> public static bool IsNumAndLetterAndUnderline(this string input) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsNumAndLetterAndUnderline(header, input)); }
/// <summary> /// 将含有指定正则表达式模式的字符串转成以该正则表达式模式匹配字符分割的字符串列表 /// </summary> /// <param name="sourceStr">要分割的字符串</param> /// <param name="patternStr">正则表达式模式的字符串</param> /// <param name="isDistinct">是否去除重复</param> /// <returns></returns> public static List <string> ToStrListByPattern(this string sourceStr, string patternStr, bool isDistinct = false) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.GetSplitStrByRegexPatternResult(header, sourceStr, patternStr, isDistinct).ToList()); }
/// <summary> /// 是否指定长度的用户名 /// </summary> /// <param name="input"></param> /// <param name="min"></param> /// <param name="max"></param> /// <returns></returns> public static bool IsUserNameWithSpecifiedLength(this string input, int min = 4, int max = 15) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.IsUserNameWithSpecifiedLength(header, input, min, max)); }
/// <summary> /// 将整型列表转成用指定字符分割的字符串 /// </summary> /// <param name="list">整型列表</param> /// <param name="spliter">分隔符</param> /// <returns></returns> public static string ToStrWithSpliter(this List <int> list, string spliter) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.GetStrByIntListWithSpliter(header, list.ToArray(), spliter)); }
/// <summary> /// 替换指定字符串 /// </summary> /// <param name="input">源字符</param> /// <param name="specialStr">指定字符串</param> /// <returns></returns> public static string ReplaceSpecialStr(this string input, string specialStr) { var header = new StringHelperProxySoapHeader() { SecretKey = SecretKey }; return(StrHelperClient.ReplaceSpecialStr(header, input, specialStr)); }