Good evening,

How do I need to put string into array characted by character? For example:

I have a string "WELCOME".

Then I can call command coolarray [ 3 ] and I got a letter L ?

Thanks!

Recommended Answers

What kind of an array? The String class has a method that will create an array from a String.
Or create the array and use another String class method to get the characters one by one and store them into the array.

BTW array indexes start at 0. L's index …

Jump to Post

You would use one of the String class's methods to get the characters of the String one by one in a loop and store them into the array.

Jump to Post

All 8 Replies

What kind of an array? The String class has a method that will create an array from a String.
Or create the array and use another String class method to get the characters one by one and store them into the array.

BTW array indexes start at 0. L's index would be 2, W 's is 0

I guess int array won't work here? So my answer would be that I will use String array. And yes I made a mistake by saying that third member would be 'L'.

You would use one of the String class's methods to get the characters of the String one by one in a loop and store them into the array.

and how do I need to use it?

try this code (the string name.indexOf(3);

how do I need to use it?

Use what?

You would use one of the String class's methods to get the characters of the String one by one in a loop and store them into the array.

I asking you directly... how to do it? I just don't have enough programing skills to make it by myself..

What code do you have so far? Where are you having problems?
Which methods of the String class are you having problems witlh?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.