gpt4 book ai didi

c - 为什么 "international currency symbol"以空格字符结尾?

转载 作者:行者123 更新时间:2023-12-02 20:11:05 25 4
gpt4 key购买 nike

// code
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>

#define SIZE 32
const char name[][SIZE] = {"en_US.utf8", "zh_CN.utf8", "zh_HK.utf8", "zh_TW.big5", "fr_BE.iso88591"};

int main(void)
{
int count = sizeof(name) / SIZE;
for (int i = 0; i < count; i++)
{
setlocale(LC_ALL, name[i]);
const struct lconv *p = localeconv();
printf("locale:[%s], currency symbol: [%s]\n", name[i], p->currency_symbol);
printf("locale:[%s], international currency symbol: [%s]\n", name[i], p->int_curr_symbol); // why a tail space
}

return 0;
}

// output
locale:[en_US.utf8], currency symbol: [$]
locale:[en_US.utf8], international currency symbol: [USD ]
locale:[zh_CN.utf8], currency symbol: [?]
locale:[zh_CN.utf8], international currency symbol: [CNY ]
locale:[zh_HK.utf8], currency symbol: [HK$]
locale:[zh_HK.utf8], international currency symbol: [HKD ]
locale:[zh_TW.big5], currency symbol: [NT$]
locale:[zh_TW.big5], international currency symbol: [TWD ]
locale:[fr_BE.iso88591], currency symbol: [EUR]
locale:[fr_BE.iso88591], international currency symbol: [EUR ]

为什么每个“国际货币符号”都以空格字符结尾?我对结果很困惑,谁可以给我一些帮助?

最佳答案

它只是用作分隔符。两个单词之间最常见的分隔符是空格。

int_curr_symbol followed by the international currency symbol. This must be a 4-character string containing the international currency symbol as defined by the ISO 4217 standard (three characters) followed by a separator. Source: http://www.tin.org/bin/man.cgi?section=5&topic=LOCALE

阅读: http://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_node/libc_111.html

关于c - 为什么 "international currency symbol"以空格字符结尾?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12579783/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com