perl - 如何使用 format_cldr("LLL") 打印首字母大写的月份名称
问题描述
我正在使用 format_cldr("LLL") 这给了我 jan, feb, mar, ... 但我需要首字母大写:Jan, Feb, Mar, ...
我尝试使用 ucfirst(),但没有成功。
这是我的一段代码:
while ($i < 13) {
my $d = DateTime->new(year=>1111, month => $i, day=>1);
$d->set_locale($self->context->locale);
@$climate[$i-1]->{month_name} = $d->format_cldr("LLL");
$i = $i + 1;
}
需要帮助,提前谢谢
解决方案
你说你试过ucfirst
了,但你没有告诉我们怎么做。
这将起作用:
@$climate[$i-1]->{month_name} = ucfirst $d->format_cldr("LLL");
推荐阅读
- javascript - 使用 async\await 重写基于 Promise 的代码
- java - JExcel - 在关闭 WritableWorkbook 之前修改多个单元格
- javascript - Mongoose + Nodejs 验证中此变量的行为
- regex - 正则表达式在数字旁边拿起“-”,但不在字母旁边
- r - 使用对 R 中列名的变量引用来提取数据子集
- javascript - 在另一个对象中获取对象属性的值(描述)
- react-native - 反应原生 JSON 过滤
- android - Android,将char数组写入sharedpreference而不创建String
- javascript - 如何使用 createRef() 将渲染道具内的子元素的 ref 转发到容器组件?
- sql-server - 更改行的顺序