Skip to content

Commit 55d0828

Browse files
committed
コード例のフォーマット文字列を修正
フォーマットフラグが波カッコで囲われていないものを修正しました。 以下の正規表現で一括変換しました。 std::format\(([^"][^,]*, )?"([^{%]*)(%[^"]+)" ↓ std::format($1"$2{:$3}"
1 parent 50237d0 commit 55d0828

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

reference/chrono/file_time.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ int main()
180180
std::cout << std::format("3 : {0:%Y/%m/%d %H:%M:%S}", tp) << std::endl;
181181
182182
// 日付だけ出力
183-
std::cout << std::format("4 : %Y年%m月%d日", tp) << std::endl;
184-
std::cout << std::format("5 : %F", tp) << std::endl;
183+
std::cout << std::format("4 : {:%Y年%m月%d日}", tp) << std::endl;
184+
std::cout << std::format("5 : {:%F}", tp) << std::endl;
185185
186186
// 時間だけ出力
187-
std::cout << std::format("6 : %H時%M分%S秒", tp) << std::endl;
188-
std::cout << std::format("7 : %T", tp) << std::endl;
187+
std::cout << std::format("6 : {:%H時%M分%S秒}", tp) << std::endl;
188+
std::cout << std::format("7 : {:%T}", tp) << std::endl;
189189
}
190190
```
191191
* fs::file_time_type[link /reference/filesystem/file_time_type.md]

reference/chrono/local_time.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,12 @@ int main()
196196
std::cout << std::format("3 : {0:%Y/%m/%d %H:%M:%S}", lt) << std::endl;
197197
198198
// 日付だけ出力
199-
std::cout << std::format("4 : %Y年%m月%d日", lt) << std::endl;
200-
std::cout << std::format("5 : %F", lt) << std::endl;
199+
std::cout << std::format("4 : {:%Y年%m月%d日}", lt) << std::endl;
200+
std::cout << std::format("5 : {:%F}", lt) << std::endl;
201201
202202
// 時間だけ出力
203-
std::cout << std::format("6 : %H時%M分%S秒", lt) << std::endl;
204-
std::cout << std::format("7 : %T", lt) << std::endl;
203+
std::cout << std::format("6 : {:%H時%M分%S秒}", lt) << std::endl;
204+
std::cout << std::format("7 : {:%T}", lt) << std::endl;
205205
206206
// 12時間時計で出力
207207
// (%pでロケール固有の「午前」「午後」を出力するには、日本のロケールを指定する必要がある)

reference/chrono/sys_time.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ int main()
229229
std::cout << std::format("3 : {0:%Y/%m/%d %H:%M:%S %Z}", now_sec) << std::endl;
230230
231231
// 日付だけ出力
232-
std::cout << std::format("4 : %Y年%m月%d日", now_sec) << std::endl;
233-
std::cout << std::format("5 : %F", now_sec) << std::endl;
232+
std::cout << std::format("4 : {:%Y年%m月%d日}", now_sec) << std::endl;
233+
std::cout << std::format("5 : {:%F}", now_sec) << std::endl;
234234
235235
// 時間だけ出力
236-
std::cout << std::format("6 : %H時%M分%S秒", now_sec) << std::endl;
237-
std::cout << std::format("7 : %T", now_sec) << std::endl;
236+
std::cout << std::format("6 : {:%H時%M分%S秒}", now_sec) << std::endl;
237+
std::cout << std::format("7 : {:%T}", now_sec) << std::endl;
238238
}
239239
```
240240
* chrono::system_clock[link system_clock.md]

reference/chrono/tai_time.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ int main()
179179
std::cout << std::format("3 : {0:%Y/%m/%d %H:%M:%S %Z}", now_sec) << std::endl;
180180
181181
// 日付だけ出力
182-
std::cout << std::format("4 : %Y年%m月%d日", now_sec) << std::endl;
183-
std::cout << std::format("5 : %F", now_sec) << std::endl;
182+
std::cout << std::format("4 : {:%Y年%m月%d日}", now_sec) << std::endl;
183+
std::cout << std::format("5 : {:%F}", now_sec) << std::endl;
184184
185185
// 時間だけ出力
186-
std::cout << std::format("6 : %H時%M分%S秒", now_sec) << std::endl;
187-
std::cout << std::format("7 : %T", now_sec) << std::endl;
186+
std::cout << std::format("6 : {:%H時%M分%S秒}", now_sec) << std::endl;
187+
std::cout << std::format("7 : {:%T}", now_sec) << std::endl;
188188
}
189189
```
190190
* chrono::tai_clock[link tai_clock.md]

reference/chrono/utc_time.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ int main()
174174
std::cout << std::format("3 : {0:%Y/%m/%d %H:%M:%S %Z}", now_sec) << std::endl;
175175
176176
// 日付だけ出力
177-
std::cout << std::format("4 : %Y年%m月%d日", now_sec) << std::endl;
178-
std::cout << std::format("5 : %F", now_sec) << std::endl;
177+
std::cout << std::format("4 : {:%Y年%m月%d日}", now_sec) << std::endl;
178+
std::cout << std::format("5 : {:%F}", now_sec) << std::endl;
179179
180180
// 時間だけ出力
181-
std::cout << std::format("6 : %H時%M分%S秒", now_sec) << std::endl;
182-
std::cout << std::format("7 : %T", now_sec) << std::endl;
181+
std::cout << std::format("6 : {:%H時%M分%S秒}", now_sec) << std::endl;
182+
std::cout << std::format("7 : {:%T}", now_sec) << std::endl;
183183
}
184184
```
185185
* chrono::utc_clock[link utc_clock.md]

reference/chrono/zoned_time.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,16 @@ int main()
176176
std::cout << std::format("4 : {0:%Y/%m/%d %H:%M:%S}", zt_sec) << std::endl;
177177

178178
// 日付だけ出力
179-
std::cout << std::format("5 : %Y年%m月%d日", zt_sec) << std::endl;
180-
std::cout << std::format("6 : %F", zt_sec) << std::endl;
179+
std::cout << std::format("5 : {:%Y年%m月%d日}", zt_sec) << std::endl;
180+
std::cout << std::format("6 : {:%F}", zt_sec) << std::endl;
181181

182182
// 時間だけ出力
183-
std::cout << std::format("7 : %H時%M分%S秒", zt_sec) << std::endl;
184-
std::cout << std::format("8 : %T", zt_sec) << std::endl;
183+
std::cout << std::format("7 : {:%H時%M分%S秒}", zt_sec) << std::endl;
184+
std::cout << std::format("8 : {:%T}", zt_sec) << std::endl;
185185

186186
// 12時間時計で出力
187187
// (%pでロケール固有の「午前」「午後」を出力するには、日本のロケールを指定する必要がある)
188-
std::cout << std::format(std::locale("ja_JP.UTF-8"), "9 : %Y年%m月%d日 %p %I時%M分%S秒", zt_sec) << std::endl;
188+
std::cout << std::format(std::locale("ja_JP.UTF-8"), "9 : {:%Y年%m月%d日 %p %I時%M分%S秒}", zt_sec) << std::endl;
189189
}
190190
```
191191
* chrono::zoned_time[color ff0000]

reference/chrono/zoned_time/formatter.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ int main()
5252
std::cout << std::format("4 : {0:%Y/%m/%d %H:%M:%S}", zt_sec) << std::endl;
5353
5454
// 日付だけ出力
55-
std::cout << std::format("5 : %Y年%m月%d日", zt_sec) << std::endl;
56-
std::cout << std::format("6 : %F", zt_sec) << std::endl;
55+
std::cout << std::format("5 : {:%Y年%m月%d日}", zt_sec) << std::endl;
56+
std::cout << std::format("6 : {:%F}", zt_sec) << std::endl;
5757
5858
// 時間だけ出力
59-
std::cout << std::format("7 : %H時%M分%S秒", zt_sec) << std::endl;
60-
std::cout << std::format("8 : %T", zt_sec) << std::endl;
59+
std::cout << std::format("7 : {:%H時%M分%S秒}", zt_sec) << std::endl;
60+
std::cout << std::format("8 : {:%T}", zt_sec) << std::endl;
6161
6262
// 12時間時計で出力
6363
// (%pでロケール固有の「午前」「午後」を出力するには、日本のロケールを指定する必要がある)
64-
std::cout << std::format(std::locale("ja_JP.UTF-8"), "9 : %Y年%m月%d日 %p %I時%M分%S秒", zt_sec) << std::endl;
64+
std::cout << std::format(std::locale("ja_JP.UTF-8"), "9 : {:%Y年%m月%d日 %p %I時%M分%S秒}", zt_sec) << std::endl;
6565
}
6666
```
6767
* chrono::system_clock[link /reference/chrono/system_clock.md]

0 commit comments

Comments
 (0)