fork download
  1. Imports System
  2.  
  3. Public Class Test
  4. Public Shared Sub Main()
  5. Dim texto As String = "def NomeDaVariavel = ValorDela;"
  6.  
  7. Dim indiceVar As Integer = texto.IndexOf("def")
  8. Dim indiceVal As Integer = texto.IndexOf("=")
  9.  
  10. Dim tamanhoVar As Integer = Len(indiceVar)
  11.  
  12. Dim varNome As String = texto.Substring(indiceVar + tamanhoVar, texto.IndexOf("=") - tamanhoVar - 1)
  13. Dim varVal As String = texto.Substring(indiceVal + 2, texto.IndexOf(";") - indiceVal - 2)
  14.  
  15. Console.WriteLine(String.Format("{0} = {1}", varNome, varVal))
  16. Console.ReadKey()
  17.  
  18. Dim palavras As String() = texto.Split(New Char() {" "})
  19. Dim palavra As String
  20. For Each palavra In palavras
  21. Console.WriteLine(palavra)
  22. Next
  23. Console.ReadKey()
  24. End Sub
  25. End Class
Success #stdin #stdout 0.06s 24576KB
stdin
Standard input is empty
stdout
NomeDaVariavel = ValorDela
def
NomeDaVariavel
=
ValorDela;