-1

I want to cut a string receiving from a server into parts and have those individual parts shown in the corresponding textView element.

The first character is the label(1,2,3,4,...) of the string and correct textView element the last one is an identifier that the next character is again the label of another part.

The individual string parts have a length of 8, including the start and end characters.

I'm a complete beginner so any help is appreciated especially if you have some good tutorials.

Omnos
  • 25
  • 8

1 Answers1

0

If you're looking to split a string and know where the split indexes are, substring is your friend

String s = // String received from server
int beginIndex = // first index
int endIndex = // end index (exclusive)
String substringOfS = s.substring( beginIndex, endIndex );

If the strings are separated by a particular delimeter (eg. space), then you can use the split function

String s = // String received from server
String[] parts = s.split( " " );
Aniruddha Deb
  • 272
  • 2
  • 7