split string only on first instance – java

I want to split a string by ‘=’ charecter. But I want it to split on first instance only. How can I do that ? Here is a JavaScript example for ‘_’ char but it doesn’t work for me
split string only on first instance of specified character

Example :

apple=fruit table price=5

When I try String.split(‘=’); it gives

[apple],[fruit table price],[5]

But I need

[apple],[fruit table price=5]

Thanks

6 Answers
6

Leave a Comment