temu推单相关功能
This commit is contained in:
1 parent
165df61234
commit
b05de6797e
27 files changed
+4561
-315
No files matched your search
@@ -39,6 +39,26 @@ namespace NaiBa.Util.Extension
|
||||
}
|
||||
}
|
||||
|
||||
public static long? ParseToNullableLong(this object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
string str = obj.ParseToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return long.Parse(str);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将object转换为long,若转换失败,则返回指定值。不抛出异常。
|
||||
/// </summary>
|
||||
@@ -82,6 +102,21 @@ namespace NaiBa.Util.Extension
|
||||
}
|
||||
}
|
||||
|
||||
public static int? ParseToNullableInt(this object str)
|
||||
{
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
return Convert.ToInt32(str);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int DecimalPointParseToInt(this object str)
|
||||
{
|
||||
try
|
||||
@@ -194,6 +229,17 @@ namespace NaiBa.Util.Extension
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public static decimal? ParseToNullableDecimal(this object str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return decimal.Parse(str.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 转化为bool
|
||||
|
||||
Reference in new issue
Block a user