2

Help Me With This PLZ. My input is:

   ("HI,How Are You?RANDOME TEXT,What About You?")

I Want my Output to be:

 ("RANDOME TEXT")

"RANDOME TEXT" can be every thing and it is not unique,How can I get a string between "How Are You?" and ",What About You?" in this example? In C# We Use Regex.Match as I can remember but I can't do anything in b4a.

b4a6445
  • 33
  • 3

1 Answers1

3

You could get first appearance index of "?" character and get last appearance index of "," character and then get substring of that. Like this:

String s = "HI,How Are You?RANDOME TEXT,What About You?";
int first = s.indexOf("?");
int last = s.lastIndexOf(",");
String subString = s.substring(first,last);

and you get the string that you want.

Masoud Mokhtari
  • 2,390
  • 1
  • 17
  • 45