How can I format a line of text such as first name, last name, phone, etc. to look like columns?
it will not be:
String customer = "\t"+surname+"\t"+givenname+"\t"+blablabla
See the documentation for String.format(). Use the maximum length that each column can be, plus 1.
String.format()
The problem with using tabs is that their width depends on the settings of the console that you use to display, which means that you cannot guarantee that all columns will be aligned using this approach.
, , . .
There are several libraries in the wild wilderness that can do this for you - with a common limitation that will usually work with monospaced fonts (e.g. Courier). One of these libraries is the iNamik Text Table Formatter for Java , but if you use Google for search java text tableyou will find a lot more.
java text table
Source: https://habr.com/ru/post/1719267/More articles:Обучение написанию многоразовых библиотек - pythonchange password without entering old password in web administration tool - asp.netimage quality degradation in Matlab - imageWCF: where to place the configuration and how to allow relative paths without HTTPContext - wcfOne-time location after installation from the application - .netXcode & Interface Builder is no longer in sync - asynchronousПочему я не могу изменить Thread.Name в .NET? - multithreadingAre there any instructions in the x86 assembly that exist only in 64-bit mode? - assemblycan't see bit (1) of fields in mysql - databaseGenerics and collections - undefined method for type - javaAll Articles