GSTrans string conversion: Difference between revisions
m
use match
m (convert some chars to escaped chars for better printing) |
m (use match) |
||
Line 647:
{{trans|Julia}}
<syntaxhighlight lang="rust">fn gs_char_encode(i: u8) -> String {
let mut resultchars = Vec::<u8>::new();
0..=31 => { resultchars.extend(['|' as u8, 64 + i])
0x7c => { resultchars.extend(['|' as u8, '
128..=255 => { // |! then recurse after subtracting 128▼
resultchars.extend(['|' as u8, '
resultchars.extend(
▲ // |! then recurse after subtracting 128
▲ resultchars.push(i);
}
return String::from_utf8_lossy(&resultchars).to_string();
|