I have a table which I want the datas to retrieved. I managed to retrieved these datas. The twist is I want to concatenate these datas(which have string type) to create a string with 160 characters. I managed to do this by having this code answered by a guy also here in Stackoverflow.
The code is this:
List<Pending> pending = db.getAllPending();
String a = "";
for (Pending pn : pending) {
if (a.length() + pn.getPm_str().length() <= 160) {
a += pn.getPm_str();
}
else
break;
}
The code concatenate the datas until such time that it has formed a 160 length string. It will disregard the other datas who happened to exceed with the limit.
My problem is, how am I going to do the same thing as for the remaining datas from the list (Which are not included in the first batch of 160 length string)? I also want these datas to be concatenated to create the same.
The concept of the program has something to do with SMS sending. Datas are concatenated and are group as one sms to be sent.
Need help.
Aucun commentaire:
Enregistrer un commentaire