int GetSubString(char *strSource, char *strResult) {
int iTmp=0, iHead=0, iMax=0;
for(int Index=0, iLen=0; strSource[Index]; Index++) {
if(strSource[Index] >= ’0′ && strSource[Index] <= ’9′ &&
strSource[Index-1] > ’0′ && strSource[Index] == strSource[Index-1]+1) {
iLen++; // 連續數字的.長度增1
} else { // 出現字元或不連續數字
if(iLen > iMax) {
iMax = iLen; iHead = iTmp;
}
// 該字元是數字,但數字不連續
if(strSource[Index] >= ’0′ && strSource[Index] <= ’9′) {
iTmp = Index;
iLen = 1;
}
}
}
for(iTmp=0 ; iTmp < iMax; iTmp++) // 將原字元串中最長的連續數字串賦值給結果串
strResult[iTmp] = strSource[iHead++];
strResult[iTmp]=’