Note that there are some explanatory texts on larger screens.

plurals
  1. POOutputting a combination of different array values depending on what has been input
    primarykey
    data
    text
    <p>I've created an android app that receives and reads in SMS messages.<br> At the moment the application reads in the SMS and converts it to an array of 8 char's as it will only ever receive messages of 8 characters. for example the message might be "AbCdEfGh" which would be converted to [A][b][C][d][E][f][G][h]. <br></p> <pre><code>if (array[0] == 'a'){ this.abortBroadcast(); Toast.makeText(context, "a", Toast.LENGTH_LONG).show(); context.sendBroadcast(in); } else if (array[0] == 'A'){ //this.abortBroadcast(); //Toast.makeText(context, "A", Toast.LENGTH_LONG).show(); //context.sendBroadcast(in); } else if (array[1] == 'b'){ this.abortBroadcast(); Toast.makeText(context, "b", Toast.LENGTH_LONG).show(); context.sendBroadcast(in); } else if (array[1] == 'B'){ this.abortBroadcast(); Toast.makeText(context, "B", Toast.LENGTH_LONG).show(); context.sendBroadcast(in); } </code></pre> <p>What I want the app to do is read each one of these chars and do something depending on if the character is uppercase or lowercase. For example if [0] equals 'a' then do something, else if [0] equals [A] then do something, and then move on and check the next element.<br><br> I would like it to go through each element of the array and do something for each character in the message, currently the app will show "a" for 'a' and "A" for 'A' perfectly, the problem being that if you enter "ab" it will still only show "a" rather than "ab". it will only show the second letter if you enter the first one as blank, for example " b" will return "b".<br><br> How should i arrange my code so that it selects and shows a combination of the arrays?? surely I do not have to just code each possible combination of the 8 characters that could be involved?? Could a switch statement be the solution? Would it be possible to implement some kind of loop so that once it has looked at the first array element, it loops round and looks at the next element?? Apologies if i have not explained this very clearly! hopefully someone with a bit more experience than me will be able to get their head round this problem. Thanks for any help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload