如何使用asc()将字符串转换为ascii [英] how to convert string into ascii using asc()

查看:136
本文介绍了如何使用asc()将字符串转换为ascii的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,

请建议我使用asc方法将字符串转换为ascii值的代码

解决方案

如果你有问题对于WindowsASCII代码,您可以查看在C#中将字符转换为ASCII [ ^ ]。

如果你有一些UTF8编码数据,这个问题没有多大意义,因为UTF8代码可以指示比ASCII代码更多的字符。

干杯

Andi

<据我所知,在C中不存在

asc(),您需要编写自己的版本。类似于:

  int  asc( char  c)
{
return int )c;
}
int asc( char * s)
{
return int )* s;
}
// etc


sir,
please suggest me the code for to convet string into ascii value using asc method

解决方案

If you have the problem of Windows "ASCII" code, you may have a look at Converting chars to ASCII in C#[^].
If you have some UTF8 encoded data, the question does not really make sense, since the UTF8 code can indicate more characters than ASCII code can.
Cheers
Andi


asc() does not exist in C as far as I know, you would need to write your own version. Something like:

int asc(char c)
{
    return (int)c;
}
int asc(char* s)
{
    return (int)*s;
}
// etc


这篇关于如何使用asc()将字符串转换为ascii的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆