You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
649 B
29 lines
649 B
2 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Web;
|
||
|
|
||
|
namespace MESWebSite.CommonClass
|
||
|
{
|
||
|
public static class StringHelper
|
||
|
{
|
||
|
public static int To16Int(this string s)
|
||
|
{
|
||
|
short result;
|
||
|
short.TryParse(s, out result);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
public static int To32Int(this string s)
|
||
|
{
|
||
|
int result;
|
||
|
int.TryParse(s, out result);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
public static string DefaultValue(this string s, string value)
|
||
|
{
|
||
|
return string.IsNullOrEmpty(s) ? value : s;
|
||
|
}
|
||
|
}
|
||
|
}
|