Получить текст из VB.NET - PullRequest
0 голосов
/ 26 марта 2020
textbox1.text ="tradeIdno 268181090713],buyToken tradeIdno 748832411131],buyToken tradeIdno 81724814287],buyToken tradeIdno 4871814],buyToken"

Dim s As String = TextBox1.Text
        s = s.Substring(s.IndexOf("tradeIdno") + 3)
        s = s.Substring(0, s.IndexOf("buyToken"))
        MsgBox(s)

Я хочу получить строку 268181090713 и новую строку 748832411131 и новую строку 81724814287 и новую строку 4871814

1 Ответ

0 голосов
/ 26 марта 2020

Вот другой способ с for / next l oop

textbox1.text ="tradeIdno 268181090713],buyToken tradeIdno 748832411131],buyToken tradeIdno 81724814287],buyToken tradeIdno 4871814],buyToken"

Dim s As String = TextBox1.Text
Dim result as string = ""
dim atnumeric as boolean = false

for x as integer = 0 to s.length - 1
     if isnumeric(string.substr(s,x,1))
          atnumeric = true
          result += string.substr(s, x, 1)
     else
         if atnumeric = true then
            result += vbcrlf
            atnumeric = false
     end if


next
msgbox(result)
...