SHARE
TWEET

Untitled

a guest May 20th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.     let addr = "3BMEXMnbEmo6vSn4GgHxSq6rhv54dWqAnk";
  3.     // let addr = "bc1qtpdptcf4ngfkwq6dr36kqaeh2n5h00rx5unkgc";
  4.     let char_n = if &addr[0..=3] == "bc1q" {
  5.         3 as usize
  6.     } else {
  7.         1 as usize
  8.     };
  9.     println!("prefix: {:?}", addr[0..=char_n].to_owned());
  10.     println!("char_1: {:?}", addr[char_n + 1..=char_n + 1].to_owned());
  11.     println!("char_2: {:?}", addr[char_n + 2..=char_n + 2].to_owned());
  12.     println!("char_3: {:?}", addr[char_n + 3..=char_n + 3].to_owned());
  13.     println!("char_4: {:?}", addr[char_n + 4..=char_n + 4].to_owned());
  14.     println!("char_5: {:?}", addr[char_n + 5..=char_n + 5].to_owned());
  15.     println!("char_6: {:?}", addr[char_n + 6..].to_owned());
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top