久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用“ "打印(標簽)不會導致對齊的列

Printing with quot;quot; (tabs) does not result in aligned columns(使用“打印(標簽)不會導致對齊的列)
本文介紹了使用“ "打印(標簽)不會導致對齊的列的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個非常奇怪的問題.寫完之后:

for (File f : currentFile.listFiles()) {if (f.isDirectory()){System.out.println(f.getName()+"	"+"Dir	"+Command.getpremission(f)+"	"+f.getTotalSpace());}別的{System.out.println(f.getName()+"	"+"文件	"+Command.getpremission(f)+"	"+f.getTotalSpace());}

我看到這個打印出來了:

see.txt 文件 rw 267642728448see1.txt 文件 rw 267642728456see2.txt 文件 rw 267642728448

為什么標簽有問題?

解決方案

基于這個問題,我使用以下代碼來縮進我的消息:

String prefix1 = "短文本:";字符串前綴 2 = "looooooooooooooong 文本:";String msg = "縮進";/** 第二個字符串在 40 個字符之后開始.破折號表示* 第一個字符串是左對齊的.*/字符串格式 = "%-40s%s%n";System.out.printf(格式,前綴1,味精);System.out.printf(格式,前綴2,味精);

這是輸出:

<上一頁>短文本:縮進looooooooooooooong 文本:縮進

這在 man 3 printf 中的標志字符"部分中有記錄.

I have a very weird problem. After writing this:

for (File f : currentFile.listFiles()) {            
    if  (f.isDirectory()){
        System.out.println(f.getName()+"	"+"Dir	"+Command.getpremission(f)+"	"+f.getTotalSpace());
    }
    else{
        System.out.println(f.getName()+"	"+"File	"+Command.getpremission(f)+"	"+f.getTotalSpace());
    }

I see this printed:

see.txt File    rw  267642728448
see1.txt    File    rw  267642728456
see2.txt    File    rw  267642728448

Why is there a problem with the tabs?

解決方案

Building on this question, I use the following code to indent my messages:

String prefix1 = "short text:";
String prefix2 = "looooooooooooooong text:";
String msg = "indented";
/*
* The second string begins after 40 characters. The dash means that the
* first string is left-justified.
*/
String format = "%-40s%s%n";
System.out.printf(format, prefix1, msg);
System.out.printf(format, prefix2, msg);

This is the output:

short text:                             indented
looooooooooooooong text:                indented

This is documented in section "Flag characters" in man 3 printf.

這篇關于使用“ "打印(標簽)不會導致對齊的列的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 日韩二三区 | 99爱在线| 一级片子| 国产欧美精品一区二区三区 | 91九色在线观看 | 久久久91精品国产一区二区三区 | 欧美一级视频免费看 | 久久久久91 | 欧美中文字幕在线观看 | 中文字幕91 | 91亚洲欧美 | 四季久久免费一区二区三区四区 | 蜜臀久久| 久久久久国产成人精品亚洲午夜 | 中文字幕av在线播放 | 久久久国产一区二区三区四区小说 | 97视频久久 | 五月槐花香 | 中文字幕亚洲视频 | 香蕉久久久久久 | jlzzjlzz欧美大全 | 日韩不卡一区二区三区 | 欧美黑人巨大videos精品 | 91国自视频 | 99精品久久久久 | 欧美乱码精品一区二区三区 | 国产一区二区精品在线 | 日韩成人 | 亚洲午夜在线 | 国产午夜av片 | 少妇诱惑av | 亚洲精品白浆高清久久久久久 | 精品一区二区三区入口 | 久久亚洲一区二区 | 国产精品特级毛片一区二区三区 | av官网在线 | 精品在线一区 | 一级视频在线免费观看 | 一区二区免费 | 国产一区二区三区免费观看视频 | 欧美一二区 |