Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP to JSP 1

Status
Not open for further replies.

jhembree

Programmer
Sep 5, 2000
18
0
0
US
I was using chr(65) to display an "A" on my web page. What is the JSP equivalent? I want to generate an A - Z list using a For/Next loop. TIA.
 
I've been trying

for(int cntr=65 ; cntr<91 ; cntr++) {
String AlphaTag=String.valueOf(cntr);

but it returns the value of cntr - a number.
???
 
I don't know exactly what you are trying to do, but this should work. Notice I changed String to char and cast the result as a char.

for(int cntr=65 ; cntr<91 ; cntr++) {
char AlphaTag=(char)(cntr);
}
 
This was a pain to get to work!!

But here it is...

Code:
    try {
      for(int i = 65; i < 91; i++) {
        String str = Integer.toString(i);
        byte [] chr   = new byte[] { Byte.parseByte(str) };
        String letter = new String(chr, &quot;UTF-8&quot;);
	    //System.out.print(letter);
	  }
	}
	catch(UnsupportedEncodingException ex) { System.out.println(ex.toString()); }
	catch(NumberFormatException ex) { System.out.println(ex.toString()); }
I hope this helped! ;-)
- Casey Winans
 
Nevermind... it seems I did it the hard way and took too long at that... oh well. I hope this helped! ;-)
- Casey Winans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top