string_vars.ion 782 B

123456789101112131415161718192021222324252627282930313233343536
  1. echo '# ANCHOR: string_variables'
  2. # The CI can not handle deletions properly.
  3. mkdir -p _tmp _tmp/t1 _tmp/t2
  4. cd _tmp
  5. let filelist = *
  6. echo $filelist
  7. cd ..
  8. echo '# ANCHOR_END: string_variables'
  9. echo '# ANCHOR: string_slicing'
  10. let foo = "Hello, World"
  11. echo $foo[..5]
  12. echo $foo[7..]
  13. echo $foo[2..9]
  14. echo '# ANCHOR_END: string_slicing'
  15. echo '# ANCHOR: string_concatenation'
  16. let string = world
  17. echo $string
  18. let string ++= !
  19. echo $string
  20. let string ::= "Hello, "
  21. echo $string
  22. echo '# ANCHOR_END: string_concatenation'
  23. echo '# ANCHOR: string_operations'
  24. let string1 = Doctor
  25. let string2 = order
  26. echo $string1
  27. echo $string2
  28. let string1 ++= "'s"
  29. let string2 ++= "s"
  30. echo $string1
  31. echo $string2
  32. let string1 ++= " "
  33. let string2 ::= $string1
  34. echo $string2
  35. echo '# ANCHOR_END: string_operations'