samedi 28 mars 2015

Fast way to dynamically indent strings in Java



I have a list with each line of the text below:



STARTTIMING: main
| STARTTIMING: loop
| | STARTTIMING: doSomeStuff()
| | STOPTIMING: doSomeStuff() 1ms
| | STARTTIMING: doSomeStuff()
| | STOPTIMING: doSomeStuff() 1ms
| STOPTIMING: loop 5ms
STOPTIMING: main 5ms


I know how to format it by using "brute force", but once it is an application for measuring performance, what is the fast way to print the strings in the format showed above (indent properly, and inserting vertical bars) in Java?




Aucun commentaire:

Enregistrer un commentaire