日期:2014-05-19  浏览次数:20799 次

字符串截取问题 ??
字符串   a=   12px;   我想得到   12   ,请问该怎么做。

新手,勿见笑,谢谢了先.......

------解决方案--------------------
a.Substring(0,a.Length-2);

或者
using System.Text.RegularExpressions;


string a = "12px ";
a=Regex.Replace(a, "(px)*$ ", " ");