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