29 lines
649 B
29 lines
649 B
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;
|
|
}
|
|
}
|
|
}
|