/help/strings.arc

http://github.com/alimoeeny/arc · Unknown · 109 lines · 83 code · 26 blank · 0 comment · 0 complexity · 299ba8744194b64608504f9009d0ed4c MD5 · raw file

  1. (doclist
  2. tokens
  3. " Splits `s' into tokens using `sep' (a character or predicate) as separator.
  4. Splits on contiguous runs of `sep's - no empty tokens are returned:
  5. arc> (tokens \"foo bar\" whitec)
  6. (\"foo\" \"bar\")
  7. See also [[slices]] [[positions]] [[halve]] "
  8. slices
  9. " Splits `s' into slices using `sep' (a character or predicate) as separator.
  10. Splits on each occurrence of `sep' - a run of `sep's produces empty slices:
  11. arc> (slices \"foo bar\" whitec)
  12. (\"foo\" \"\" \"bar\")
  13. See also [[tokens]] [[positions]] [[halve]] "
  14. halve
  15. " Splits `s' on the first instance of `sep' (a character or predicate).
  16. In more detail: Returns a list whose car is `s' up to the first occurrence
  17. of `sep', or all of `s' if `sep' never appears, and whose cadr (if `sep'
  18. appears) is the rest of `s' (including the leading `sep').
  19. See also [[tokens]] [[cut]] [[pos]] "
  20. positions
  21. " Lists all indices in `seq' which pass `test'. "
  22. lines
  23. " Splits `s' into a list of lines (not including line-terminators).
  24. See also [[tokens]] [[positions]] "
  25. urldecode
  26. " Decodes the string `s' as per application/x-www-form-urlencoded.
  27. See also [[urlencode]] "
  28. urlencode
  29. " Encodes the string `s' as per application/x-www-form-urlencoded.
  30. See also [[urldecode]] "
  31. litmatch
  32. " Test if `seq' starting at offset `start' begins with `pat'. Because of the
  33. macro expansion, `pat' must be a literal.
  34. See also [[endmatch]] [[headmatch]] [[begins]] "
  35. endmatch
  36. " Test if `seq' ends with `pat'. Because of the macro expansion, `pat' must be
  37. a literal.
  38. See also [[litmatch]] "
  39. posmatch
  40. " Return the index (from `start') where `pat' appears in `seq'. If `pat' is a
  41. predicate, it is applied to the characters of `seq' until it returns true.
  42. See also [[findsubseq]] [[pos]] "
  43. headmatch
  44. " Tests if `seq' from offset `start' onwards starts with `pat'. `headmatch'
  45. will die if `pat' is longer than `seq' and matches up to the end of `seq'.
  46. See also [[begins]] [[litmatch]] "
  47. begins
  48. " Tests if `seq' begins with `pat'. Equivalent to `(headmatch pat seq start)',
  49. except it doesn't die if matching goes past the end of `seq'.
  50. See also [[headmatch]] [[litmatch]] "
  51. subst
  52. " Substitutes `new' for `old' in `seq'. `new' can be any printable object.
  53. See also [[multisubst]] "
  54. multisubst
  55. " For each pair in `pairs', substitutes its cadr for its car in `seq'.
  56. See also [[subst]] "
  57. findsubseq
  58. " Finds the index where `pat' appears in `seq', starting at `start'.
  59. As `posmatch', but doesn't accept a function for `pat'.
  60. See also [[posmatch]] "
  61. blank
  62. " Tests if `str' is blank (entirely whitespace).
  63. See also [[nonblank]] [[whitec]] "
  64. nonblank
  65. " Returns nil if `s' is blank, and `s' otherwise.
  66. See also [[blank]] "
  67. trim
  68. " Trims character which pass `test' from `str'. `where' can be 'front, to trim
  69. the front of the string, 'back, to trim the end; or 'both, to trim both. "
  70. num
  71. " Formats a real number. `digits' is the number of digits after the decimal
  72. point, `trail-zeroes' indicates whether trailing zeros should be included,
  73. and `init-zero' indicates whether there should be a zero before the
  74. decimal point (if `(< -1 n 1)'). "
  75. pluralize
  76. " Returns `str' pluralized. If `n' is 1 or a list of length 1, `str' is
  77. returned unchanged; otherwise an `s' is appended.
  78. See also [[plural]] "
  79. plural
  80. " Returns a string \"<n> <x>\" representing `n' of `x' in english, pluralizing
  81. `x' if necessary.
  82. See also [[pluralize]] "
  83. )