Get only numbers from string

前端 未结 8 597
耶瑟儿~
耶瑟儿~ 2021-01-01 15:37

i want to get only numbers from string.

Lest say that this is my string :

324ghgj123

i want to get:

324123
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-01 16:10

    you can use Regex for this

    Imports System.Text.RegularExpressions
    

    then on some part of your code

    Dim x As String = "123a123&*^*&^*&^*&^   a sdsdfsdf"
    MsgBox(Integer.Parse(Regex.Replace(x, "[^\d]", "")))
    

提交回复
热议问题