RosettaCodeData/Task/Character-codes/Ballerina/character-codes.ballerina

16 lines
377 B
Text
Raw Permalink Normal View History

2025-06-11 20:16:52 -04:00
import ballerina/io;
public function main() returns error? {
int[] cps = [];
foreach string c in ["a", "π", "字", "🐘"] {
int cp = c[0].toCodePointInt();
cps.push(cp);
io:println(`${c} = ${cp}`);
}
io:println();
foreach int i in cps {
var c = check string:fromCodePointInt(i);
io:println(`${i} = ${c}`);
}
}