2013-11-20 61 views

回答

0

從這個字符串,我想取0078.

試試這個,

Dim xString as String = "0066,0055,0078" 
Dim xResult() as String = xString.split(",") 
Dim xExtracted as String = xResult(xResult.length-1) 

MsgBox(xExtracted) 
+0

@Downvoter小心解釋您的投票。 –

+0

謝謝Raja,我試過一樣,得到一個編譯器錯誤,因爲「選項strict在禁止晚期綁定」。 – theanalyst

+0

@ user2957476你得到的錯誤是什麼? –

0

較短的替代方案是:

Dim xString as String = "0066,0055,0078" 
MsgBox(xString.Substring(xString.LastIndexOf(",") + 1)) 

如果您打算使用該功能,請定期考慮創建擴展方法

相關問題