If you can not or do not want to answer the questions, dont interrupt. I dont need any advice for hiring someone to solve my problem.
This forum is for helping other people who are naive to the language or are stuck or not brilliant/expert like other people in this domain, so please refrain from writing such answers.
Thanks.
> If you can not or do not want to answer the
> questions, dont interrupt. I dont need any advice for
> hiring someone to solve my problem.
>
> This forum is for helping other people who are naive
> to the language or are stuck or not brilliant/expert
> like other people in this domain, so please refrain
> from writing such answers.
>
> Thanks.
You are being rude to ask for a quick response to people who post answers on a voluntary basis. If you want such kind of service, pay for it!
And I will post whatever I like in your thread, just as much as you can post your demands here.
> I would like to retain only A(s), how can I do it using the split function?
> or some other way?
You didn't describe the criteria for retaining A(s). How could one help you then?String input = "A(s)(age)";
String result1 = "A(s)";
String result2 = input.substring(0, 4);
String result3 = input.replaceAll("\\([^s]+\\)", "");
String result4 = input.split("\\(age\\)")[0];
...
> > I would like to retain only A(s), how can I do it
> using the split function?
> > or some other way?
>
> You didn't describe the criteria for retaining
> A(s). How could one help you then?String
> input = "A(s)(age)";
>
> String result1 = "A(s)";
> String result2 = input.substring(0, 4);
> String result3 = input.replaceAll("\\([^s]+\\)",
> "");
> String result4 = input.split("\\(age\\)")[0];
> ...
Thanks for the suggestions.
By the way A(s)(age) is just an example, I just meant that there can be more than 1 bracket and any value in them, and then I would like to keep the first bracket and discard everything after that.
Thanks anyways.
Regards,
Shef
> By the way A(s)(age) is just an example
And you know my suggestions are just nonsense, don't you?
> I just meant that there can be more than 1 bracket and any value in
> them, and then I would like to keep the first bracket and discard
> everything after that.
You mean you need to extract the starting substring up to and including the first sequence that lays between parenthesis ? I would then suggest:input.substring(0, input.indexOf(')', input.indexOf('(')) + 1)