如何在飞镖中读取String
的字节?
在Java中,可以通过String
方法getBytes()
来实现。
答案 0 :(得分:3)
String foo = 'Hello world';
List<int> bytes = utf8.encode(foo);
print(bytes);
输出:[72、101、108、108、111、32、119、111、114、108、100]
答案 1 :(得分:1)
有一个codeUnits
的获取器,它返回UTF-16
String foo = 'Hello world';
List<int> bytes = foo.codeUnits;
print(bytes);
[72,101,108,108,111,32,119,111,114,108,100]
和runes
返回Unicode代码点
String foo = 'Hello world';
// Runes runes = foo.runes;
// or
Iterable<int> bytes = foo.runes;
print(bytes.toList());
[72,101,108,108,111,32,119,111,114,108,100]
答案 2 :(得分:0)
对于图像,它们可能是base64编码的,请使用
input[type=text]:not(.browser-default):focus:not([readonly]) {
border-bottom: 2px solid var(--yourcolor);
box-shadow: 0 0 0 0 var(--yourcolor);
}
导入功能
Image.memory(base64.decode('base64EncodedImageString')),