This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes indent whitespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "indent whitespace" Watch "indent whitespace" New topic
Author

indent whitespace

nate saider
Greenhorn

Joined: Jun 24, 2002
Posts: 17
Is there anyway to indent output based on the integer value of an variable?
for example...
if

then

will indent "hello" three times over and output
>[/n][/n][/n]Hello
and not
>Hello
thanks.
[ July 29, 2002: Message edited by: nate saider ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
One strategy you might consider would be use a loop to prefix your output with the appropriate number of space characters. Take a look at http://www.asciitable.com to find which character is the space character (hint: it's number 32).


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: indent whitespace
 
It's not a secret anymore!