Substrings and Indexes

I am creating a mobile site using J2me, ASP and WML.

I read from the database and created the row as the next one so that later it could be called.

                string id = reader[0].ToString();
                string name = reader[1].ToString();
                Response.Write("#" + name + id);

in J2me I will remind this as

stringItem3.setText("Welcome  "+result.substring(result.indexOf("#")+1)
  + "ID " + result.substring(result.indexOf("#")+2));

and the results are not the way I wanted, I tried to change the syntax a lot, but no luck.

results are always displayed as

enter image description here

while I really want to show something like

Welcome  (name)  ID : (id)
or
Welcome  Arin  ID : 20111

What is the best way to get the right results?

And can I later save the id value in a string inside J2me so that I can use it later (yes / no)?


I changed the line (decided)

string id = reader[0].ToString();
string name = reader[1].ToString();
Response.Write("*"+ id + "#" + name); 

and upon receipt of information

stringItem3.setText("Welcome  "+result.substring(result.indexOf("#")+1)
  + "ID " + result.substring(result.indexOf("*")+1,result.indexOf("#")));

result.substring(result.indexOf("*")+1,result.indexOf("#")));

which is the average for getting characters between "*" and "#"

the results will now be accurate as shown below.

enter image description here

+3
source share
1 answer

, , #Arin20111, indexOf("#")+2 2 nd #.

So result.substring(result.indexOf("#")+1) - #, . result.substring(result.indexOf("#")+1) - , A .

, #, #Arin#20111. - <sup>st</sup> # and before the 2<sup>nd</sup> # , and the ID is everything after the 2<sup>nd</sup> # `.

+2

All Articles