-3

I'm trying to make a small scripting programming language to test my skills.

I was wondering how I could split the parameters in a function. So the syntax goes like this:

test "bla,bla,bla", "othertext"

How could I split those 2 parameters at the , in the middle without worrying the , chars in the string? Is there a regex to make things a little more easy?

Matto
  • 61
  • 1
  • 8

1 Answers1

-1
    String str = "\"bla,bla,bla\", \"othertext\"";
    int p = str.lastIndexOf(',');
    String parameter1 =str.substring(0, p);
    String parameter2 =str.substring(p+1);
Leon
  • 3,124
  • 31
  • 36