Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Divide one String into 2 String values from responseBody

Tags:

android

With this function I got a String from the server as a response:

String responseBody = EntityUtils.toString(response.getEntity());

the String value I retrieve looks more or less like this:

"http://url.com 765889"

I want to divide the URL and the numbers into 2 String values, it should be:

String 1="http://url.com" 
String 2="765889"

How am I able to perform that?

like image 866
hectichavana Avatar asked Jul 25 '26 17:07

hectichavana


1 Answers

Use the split() function:

String[] parts = responseBody.split(" ");
like image 109
Maciej Gryka Avatar answered Jul 28 '26 13:07

Maciej Gryka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!