#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main(int argc, char * argv[]) {
string s="a A";
cout << "字符串长度: "<< s.size()<< endl;
cout << "字符串中的字节: "<< endl;
for (string::size_type i=0; i< s.size(); i++) {
cout <<setfill('0')<< setw(2)<<hex<< (int)(0x0ff &s[i]) << " ";
}
cout << endl;
return 0;
}
测试 byte字符串长度 及 字节 c++
最新推荐文章于 2023-02-21 17:56:58 发布