Computing.Net > Forums > Programming > java for loops

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

java for loops

Reply to Message Icon

Name: gimmpy225
Date: June 13, 2005 at 21:23:52 Pacific
OS: Windows XP pro
CPU/Ram: Athlon 64 3000+ / 1 gig
Comment:

K, im currently learning java and I wanted to make a program that is short and prints all the unicode symbols out in the cmd prompt (preferably on the same line).

One way I was attempting to acheive this was with 2 for loops working together, 1 to iterate through an array of 9999 strings and 1 to put each unicode number in each of the cells of the array.

I just cant figure out how to do this..... would i really need 2 for loops?


Im writing this in Java.

not sure if I provided you with enough info on what im attempting to do so ill try to sum it up, Any way to print every unicode symbol to the screen.

GIMPS



Sponsored Link
Ads by Google

Response Number 1
Name: Guy
Date: June 15, 2005 at 20:03:20 Pacific
Reply:

Well, if I understand what you want, I think you should be able to do this with one for loop.

I'll leave you to figure that out.

Have you looked at all the infomation at:

http://www.unicode.org


?????

There is some Java specific stuff there.

Hope this gives you some ideas .......

Guy


0

Response Number 2
Name: gimmpy225
Date: June 16, 2005 at 00:00:32 Pacific
Reply:

well i thought 1 would work, but i cant figure out how to get it to iterate from 0001 to 9999

i mean how do i make it go from 0001 to 0009 then 0010 to 0099 then 0999 to 1000?

cause i can get 1000-9999 no problem, its those first ones i have no idea how to get, I guess if i used 4 for loops?

but even then I dont think java let me do

for(i=1;i<=9;i++)
{
a[--i]="\u000"i;
}

without having a fit about it lol.

ofcourse erlier in the code there was String[] a = new String[9998]
GIMPS


0

Response Number 3
Name: Guy
Date: June 16, 2005 at 11:28:39 Pacific
Reply:

Well, my first cut would be:

char[] uc = new char[1000];
for (int i = 0;i < 1000;i++)
{
uc[i] = (char)i;
}

You should also take a look at this sample code:

http://sunsite.tus.ac.jp/java/JDK1.1/docs/guide/awt/demos/symboltest/

Guy


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: java for loops

Batch file FOR LOOP www.computing.net/answers/programming/batch-file-for-loop/11504.html

count in for loop in dos www.computing.net/answers/programming/count-in-for-loop-in-dos/16609.html

Batch FOR Loop %ERRORLEVEL% www.computing.net/answers/programming/batch-for-loop-errorlevel/13528.html