title = com.substring(com.indexOf('AVRCP_MEDIA TITLE:') + 2, com.indexOf("\n")); // extract the title part of the string
OK, I get it. But when I had it set up that way, I got the following results:
Ready.
Captain
Dave Matthews Band
Busted Stuff
337
498
Rock
225558
title = com.substring(com.indexOf("AVRCP_MEDIA TITLE:") + 2, com.indexOf("\n")); // extract the title part of the string
With the correct quotes, I get this result:
Ready.
RCP_MEDIA TITLE: Captain
AVRCP_MEDIA ARTIST: Dave Matthews Band
AVRCP_MEDIA ALBUM: Busted Stuff
AVRCP_MEDIA NUMBER: 337
AVRCP_MEDIA TOTAL_NUMBER: 498
AVRCP_MEDIA GENRE: Rock
AVRCP_MEDIA PLAYING_TIME(MS): 225558
Again, I'm not an expert in this (obviously), so I need help on the process of looking for a section of a string that starts with "abc" and stops at "xyz". I have searched and found all kinds of examples on how to find text at a known position in the string, but nothing on parsing a string as I described above.
Am I using indexOf in vein? Is there a better command to accomplish what I'm looking for? Thanks again, and no, I don't have an ""AVRCP_MEDIA TITLE:" key, that was the more expensive option.. ![]()