using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace iWare.Wms.Core.Util
{
public static class StringUtil
{
///
/// 获取下划线表达式
///
///
///
public static string ToUnderLine(string camel)
{
return Regex.Replace(camel, "([A-Z])", "_$1").ToLower().TrimStart('_');
}
public static string ParseTrueType(string dataType)
{
if (!dataType.StartsWith("System.Nullable")) return dataType;
return new Regex(@"(?i)(?<=\[)(.*)(?=\])").Match(dataType).Value;
}
public static string ParseTrueType2(string dataType)
{
if (!dataType.StartsWith("System.Nullable")) return dataType;
var str = new Regex(@"(?i)(?<=\[\[)(.*)(?=\]\])").Match(dataType).Value;
var args = str.Split(',');
return args.Length > 0 ? args[0] : "";
}
}
}