Guest User

Untitled

a guest
Nov 16th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. fn main() {
  2. let content: String = " \\UI\\Icon\\stone\\31001.dds {#ffffd052=Н­±Т#} {#ffffd052=Н­±Т#} {#ffffd052=Н­±Т#}      
  3.    Ќ#     , > и Ђ? яя  …ы яяя UI".to_string();
  4. let chars = content.chars();
  5.  
  6. let mut t: Vec<String> = Vec::new();
  7. let mut temp: String = String::new();
  8.  
  9. let mut last_chars = '\0';
  10. for ch in chars{
  11. if get_chars(ch.clone()){ //println!("!");
  12. if last_chars == 'U' && ch == 'I'{
  13. let count = temp.chars().count();
  14. temp.remove(count - 1 );
  15. temp.remove(count - 2 );
  16. t.push(temp.clone());
  17. temp = String::new();
  18. temp.push('U');
  19. temp.push('I');
  20. } else {
  21. temp.push(ch);
  22. }
  23. last_chars = ch;
  24. }
  25. } t.push(temp);
  26. println!("{:?}", t);
  27. }
  28.  
  29.  
  30. fn get_chars(ch: char)->bool{
  31. let s: String = "qQwWeErRtTyYuUiIoOpP[{]}aAsSdDfFgGhHjJkKlL;:'\"zZxXcCvVbBnNmM,<.>/?\\`~1234567890"
  32. .to_string();
  33. for char_ in s.chars(){
  34. if ch == char_ { return true; }
  35. }
  36. false
  37. }
Add Comment
Please, Sign In to add comment