【问题标题】:Conver country name to lowercase将国家名称转换为小写
【发布时间】:2019-06-02 12:24:30
【问题描述】:

我正在尝试获取 Open Weather Map API 的国旗图标: 示例:http://openweathermap.org/images/flags/br.png

api请求返回的国家代码json为大写, 要获得正确的国家/地区图标,我需要相同的国家/地区代码,但要小写

这是我尝试过的:

<img src="http://openweathermap.org/images/flags/{{lowerCase(weather.sys.country)}}.png">

【问题讨论】:

标签: javascript html angular typescript openweathermap


【解决方案1】:

命令是toLowerCase,是一个字符串函数。

<img src="http://openweathermap.org/images/flags/{{weather.sys.country.toLowerCase()}}.png">

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-10
  • 1970-01-01
  • 1970-01-01
  • 2020-08-07
  • 1970-01-01
相关资源
最近更新 更多