久久久久久久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(使用線程逐塊處理文件)
主站蜘蛛池模板: 国产精品久久久久久妇女6080 | 牛牛热在线视频 | www.日韩| 精品九九 | 亚洲夜夜爽 | 97伦理最新伦理 | 国产精品999 | 午夜视频网站 | 青青操91| 成人黄色av | 国产美女h视频 | 色综合久 | 久久国内 | 凹凸日日摸日日碰夜夜 | 在线视频日韩 | 亚洲高清免费 | 一区二区在线不卡 | 狠狠色综合欧美激情 | 偷拍自拍在线观看 | 欧美h视频 | 日本精品一区二区三区在线观看视频 | 亚洲精品在线看 | 国产精品精品视频一区二区三区 | 真人毛片| 国产91丝袜在线熟 | 91视频在线网站 | 五月婷六月丁香 | 亚洲欧美日韩在线不卡 | 久久精品一级 | 欧美aa在线 | 国产精品一区二区三区久久久 | 欧美在线视频一区二区 | 亚洲天堂精品久久 | 亚洲成人高清 | 国产成人一区二区 | 成人网在线观看 | 99视频免费 | 一区二区三区av | 国产久 | 成人性生交大片免费看r链接 | 国户精品久久久久久久久久久不卡 |