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

在 String.format() 中選擇參數(shù)

Selecting parameters in String.format()(在 String.format() 中選擇參數(shù))
本文介紹了在 String.format() 中選擇參數(shù)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

C# 中,您可以使用 para 2: {2} 指定用于格式化字符串的參數(shù).這允許在任意位置多次使用參數(shù).

In C# you can specify which parameter is used for a formatted string with para 2: {2}. This allows for using parameters in arbitrary places and multiple times.

有沒有辦法用標(biāo)準(zhǔn) java 做到這一點(diǎn)?

Is there a way to do this with standard java?

推薦答案

是的.您可以定義參數(shù)的索引,請參閱 Argument Index 部分.html" rel="noreferrer">API.

Yes. You can define the argument's index, see the Argument Index section of the API.

例如:

//                 ┌ argument 3 (1-indexed)
//                 | ┌ type of String
//                 | |  ┌ argument 2
//                 | |  | ┌ type of decimal integer
//                 | |  | |  ┌ argument 1
//                 | |  | |  | ┌ type of decimal number (float)
//                 | |  | |  | |
System.out.printf("%3$s %2$d %1$f", 1.5f, 42, "foo");

輸出

foo 42 1.500000

注意

以下成語都有相同的格式定義:

The following idioms all share the same format definitions:

  • String#format
  • PrintStream#printf
  • Formatter#format

這篇關(guān)于在 String.format() 中選擇參數(shù)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉(zhuǎn)換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉(zhuǎn)換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當(dāng)前星期幾的值)
主站蜘蛛池模板: 久久aⅴ乱码一区二区三区 91综合网 | 国产精品a久久久久 | 丝袜天堂| 亚洲狠狠爱一区二区三区 | 国产视频91在线 | 性视频一区 | 精品久久中文 | 亚洲国内精品 | 热久久999 | 综合久久一区 | 亚洲欧美综合精品另类天天更新 | 国产精品一区二区在线 | 91精品国产综合久久婷婷香蕉 | 91视频88av| 金莲网 | 91精品国产91久久久久游泳池 | 亚洲3级| 日韩视频在线观看一区二区 | 国产成人精品一区二区三区视频 | 精精国产xxxx视频在线 | 在线观看国产91 | 中文字幕久久久 | 欧美日韩精品一区 | 日韩久久久久久久 | 久久精彩 | 欧美日韩中文字幕在线播放 | 国产美女一区二区三区 | 在线观看特色大片免费网站 | 欧美激情国产日韩精品一区18 | 一区中文字幕 | 久久蜜桃av一区二区天堂 | 日本黄色的视频 | 成人视屏在线观看 | 欧美一区二区三区在线观看 | 中文字幕 在线观看 | 日韩伦理一区二区 | 欧美日韩在线精品 | 91精品在线观看入口 | 国产高清精品网站 | 91在线第一页 | 成人精品一区 |