methods.ion 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. let array = [ one two three four ]
  2. let space_string = $join(array)
  3. let comma_string = $join(array ', ')
  4. echo $space_string
  5. echo $comma_string
  6. echo @split(space_string)
  7. echo @split(comma_string ', ')
  8. let array = ["one two" "three four" "five six" "seven eight" "nine ten"]
  9. echo $len(@array)
  10. for element in 0..$len(@array)
  11. echo @array[$element]
  12. end
  13. let string = "one 😉😉😉 two 😉😉😉 three 😉😉😉 four 😉😉😉 five"
  14. echo $len(string) $len_bytes(string)
  15. for grapheme in 0..$len(string)
  16. echo $string[$grapheme]
  17. end
  18. echo $replace("one two one two" one 1)
  19. echo $replacen("one one one one" one 1 3)
  20. echo $repeat("one " 5)
  21. echo $join([one two three] "\n")
  22. echo $join([one two three] "\t")
  23. echo $join([one two three] '\\n')
  24. echo $join([one two three] "\\\\n")
  25. echo $replace($join([one two three] "\n") "\n" "\t")
  26. let a = "applesauce"
  27. let pos = $find(a "s")
  28. let array = [@split_at(a $pos)]
  29. echo $join(array "\n")
  30. let a = [1 2 3 4 5]
  31. let b = "1 2 3 4 5"
  32. echo $join(@split(b " ") $join(a " "))
  33. echo $regex_replace("one two onemy anemy town" "\ o|\ a" "\ e")
  34. echo $unescape('one two\"\tone')
  35. echo $escape("'one two'")
  36. let spacey = " Spacey "
  37. echo $trim(" So Space ")!
  38. echo $trim($spacey)!
  39. echo $trim_end(" So Space ")!
  40. echo $trim_end($spacey)!
  41. echo $trim_start(" So Space ")!
  42. echo $trim_start($spacey)!