PabloEduardo

clonesfnc

Feb 26th, 2022 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. on script load:
  2. set {_letters} to "Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz"
  3. set {_letter-pairs::*} to {_letters} split at " "
  4. loop {_letter-pairs::*}:
  5. set {_pair::*} to loop-value split at ""
  6. set {_uppercase} to {_pair::1}
  7. set {_lowercase} to {_pair::2}
  8. set {letters::uppercase::%{_lowercase}%} to {_uppercase}
  9. set {letters::lowercase::%{_uppercase}%} to {_lowercase}
  10.  
  11. on script unload:
  12. delete {letters::*}
  13.  
  14. function switchCaseFor(text: text, to-uppercase: boolean) :: text:
  15. set {_characters::*} to {_text} split at ""
  16. set {_new} to ""
  17. loop {_characters::*}:
  18. set {_char} to loop-value
  19. if {_to-uppercase} is false:
  20. set {_char} to {letters::lowercase::%loop-value%}
  21. set {_new} to "%{_new}%%{_char}%"
  22. return {_new}
  23.  
  24. function lowercase(text: text) :: text:
  25. return switchCaseFor({_text}, false)
  26.  
  27. function contains(list: objects, check: object) :: boolean:
  28. loop {_list::*}:
  29. if loop-value is {_check}:
  30. return true
  31. return false
  32.  
  33. function nickfix(nick: text) :: text:
  34. set {_} to "abcdefghijklmnopqrstuvwxyz0123456789"
  35. set {_1} to {_nick}
  36. set {_2} to {_nick}
  37. set {_l::*} to {_} split at ""
  38. loop {_l::*}:
  39. replace every loop-value with "" in {_1}
  40. set {_l2::*} to {_1} split at ""
  41. loop {_l2::*}:
  42. replace every loop-value with "" in {_2}
  43. return {_2}
Add Comment
Please, Sign In to add comment