Hello everyone,

I'm trying to create a diagram of numbers as represented by asterisks. I'm taking an integer and turning it into a string of *. For example, for the value of 4, it'd be ****. For the value of 7, it'd be *******. Does anyone know of a way this can be done? I just can't think of anything.

To create a string of "n" stars:
1. Have a loop that executes n times and adds a star each time.
2. Start with a string that contains a lot of stars and use substring(...) to get the first n characters from that string.
3. I'm sure there are other ways as well.

Be a part of the DaniWeb community

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