if(readString.indexOf("CD") >=0) {
data=readString.substring(2);
While I'm not an advocate of the String class, I do want to point out some things here.
Notice that the substring starts at position 2 (so, positions 0 and 1 get skipped).
Notice too that the string in the indexOf() call is 2 characters long.
Finally, notice that the code assumes that the "CD" actually starts in position 0.
A somewhat more robust way of getting the data after a known string would be:
String lookFor = "CD: ";
int pos = readString.indexOf(lookFor);
if(pos > 0)
{
data = readString.substring(pos + lookFor.length());
}
If readString contains "CD: Billy Joel's Greatest Hits", pos will be 0, and lookFor.length() will be 4, so data will be the substring starting at position 4, meaning that 0, 1, 2, and 3 ("CD: ") are skipped.
If readString cotains "My CD: Billy Joel's Greatest Hits", pos will be 3, and lookFor.length() will be 4, so data will be the substring starting at position 7, meaning that 0 to 6 ("My CD: ") are skipped.