Jemu Patel
Jemu Patel

Reputation: 81

How to convert Character into Integer or Ascii value in flutter?

String id = "GJBR3I6R";

how to convert String id into integer or Ascii value ?

Upvotes: 4

Views: 5683

Answers (2)

GVV Nagaraju
GVV Nagaraju

Reputation: 31

 import 'dart:convert';
 String id = "GJBR3I6R";
const asciiEncoder = AsciiEncoder();
print(AsciiEncoder().convert(id));

Output:

[71, 74, 66, 82, 51, 73, 54, 82]

for more information about how to convert string to its ASCII value refer to the below link https://kodeazy.com/flutter-string-to-ascii/

Upvotes: 3

Shar
Shar

Reputation: 507

You can do the following:

String id = "GJBR3I6R";
print(id.codeUnits);

Output:

[71, 74, 66, 82, 51, 73, 54, 82]

Upvotes: 7

Related Questions