fsw2swu function
Implementation
String fsw2swu(String fswText) {
if (fswText.isEmpty) {
return '';
}
String swu = fswText;
// Replacing FSW marks with SWU mark characters.
_fswMarkToSwu.forEach((mark, code) {
swu = swu.replaceAll(mark, String.fromCharCode(code));
});
// Replacing FSW symbol keys (S + 5 hex) with SWU symbol characters.
swu = swu.replaceAllMapped(
RegExp(r'S[0-9a-f]{3}[0-5][0-9a-f]'),
(match) => key2swu(match.group(0)!),
);
// Replacing FSW coordinates (NNNxNNN) with SWU coordinate characters.
swu = swu.replaceAllMapped(
RegExp(r'(\d{3})x(\d{3})'),
(match) =>
position2swu(int.parse(match.group(1)!), int.parse(match.group(2)!)),
);
return swu;
}