1
I’m creating a programming language and for you to define variables in it you use this code:
def NomeDaVariavel = ValorDela;
And wanted to know how I only take the field Nome da variável
, separate from the ValorDela
.
Any ideas? Thank you.
Updating
If (Regex.IsMatch(currentText, "^\s*(def)")) Then
Dim tempProvider As Match = Regex.Match(currentText, "^\s*def.*[^=]=")
Dim nomeDaVariavel As String = tempProvider.Value.Substring(
currentText.IndexOf("def") + Iff(currentText.Trim() = " = ", 4, 3)).Replace("=", "").Replace(" ", "")
Dim valorDaVariavel As String = ParseStr(currentText)
MsgBox(FX("A Variável '\0' tem o valor de '\1'.", nomeDaVariavel, valorDaVariavel))
Continue For
End If
That worked because I tested it like this:
def testando = 'Olá, mundo!';
And it worked! Here’s the tip ;-)
I liked this method, but there’s only her name, and the value?
– CypherPotato
@Cypherpotato I already added.
– stderr