代码拉取完成,页面将自动刷新
数字-字符串类型。
负责把一个数字映射成一个字符串。
示例:
static const int_str_t color_values[] = {{1, "red"}, {2, "black"}, {3, "blue"}, {4, "white"}};
const char* value = int_str_value(color_values, 3);
int32_t name = int_str_name(color_values, "blue", 0);
printf("value = %s \n", value);
printf("name = %d \n", name);
函数名称 | 说明 |
---|---|
int_str_name | 根据value获取对应的name。 |
int_str_value | 根据name获取对应的value。 |
根据value获取对应的name。
int32_t int_str_name (const int_str_t* items, const char* value, int32_t defval);
参数 | 类型 | 说明 |
---|---|---|
返回值 | int32_t | 返回name。 |
items | const int_str_t* | int_str_t数组。 |
value | const char* | value。 |
defval | int32_t | 如果没有找到对应的name,则返回的defval默认值。 |
根据name获取对应的value。
const char* int_str_value (const int_str_t* items, int32_t name);
参数 | 类型 | 说明 |
---|---|---|
返回值 | const char* | 返回value。 |
items | const int_str_t* | int_str_t数组。 |
name | int32_t | name。 |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。