/// <summary>
/// 获取字符串最长的数字
/// </summary>
/// <param name="inputStr">输入字符串</param>
/// <returns>最长数字</returns>
public
string
GetMaxLenNumber(
string
inputStr)
{
char
[] strCharArray = inputStr.ToCharArray();
int
startPos = 0;
int
tempCharCount = 0;
int
maxLen = 0;
int
len = strCharArray.Length;
int
pos = 0;
while
(startPos < len)
{
int
tempMax = 0;
while
(tempCharCount + startPos < len)
{
char
c = strCharArray[tempCharCount + startPos];
if
(
char
.IsNumber(c))
{
tempMax++;
if
(tempMax > maxLen)
{
maxLen = tempMax;
pos = startPos;
}
}
else
{
tempMax = 0;
startPos++;
break
;
}
tempCharCount++;
}
if
(startPos + tempCharCount == len)
{
break
;
}
tempCharCount = 0;
}
string
s = inputStr.Substring(pos, maxLen);
return
s;
}