Rust Requires Chilkat v11.2.0+
Rust
Base62 Encoding and Decoding
Demonstrates base62 encoding and decoding.Chilkat Rust Downloads
let bd = chilkat::BinData::new();
// Base62 encode.
let _ = bd.append_string("hello world", "utf-8");
let base62_encoded = bd.get_encoded("base62").unwrap_or_default();
println!("hello world --> {}", base62_encoded);
// Output:
// hello world --> AAwf93rvy4aWQVw
// Base62 decode
let sb = chilkat::StringBuilder::new();
let _ = sb.decode_and_append("AAwf93rvy4aWQVw", "base62", "utf-8");
println!("decoded: {}", sb.get_as_string().unwrap_or_default());
// Output:
// decoded: hello world