Sha256: c350a1ae16c2c2c0c0dc08c14f792c73cbe794b1cc40fe315bc6f698197fa3ec

Contents?: true

Size: 1.9 KB

Versions: 5

Compression:

Stored size: 1.9 KB

Contents

(examples-for string-split
  ("splits a string using given expression"
   (string-split "a and b and c and d" " and ")
   ("a" "b" "c" "d"))

  ("returns empty leading, internal, and trailing segments"
   (string-split "and" "and")
   ("" ""))

  ("returns empty leading, internal, and trailing segments"
   (string-split "andandand" "and")
   ("" "" "" "")))

(examples-for string-replace
  ("replaces parts of a string with the given replacement"
   (string-replace "and" "or" "a and b and c and d")
   "a or b or c or d")

  ("replace with regexp"
   (string-replace "and|or" "x" "a and b or c and d")
   "a x b x c x d"))

(examples-for string-match
  ("match with regexp"
   (let m (string-match "a and b and c and d" "and")
     (list m.match m.captures))
   ("and" nil))

  ("no match with regexp"
   (let m (string-match "a and b and c and d" "not-in-string")
     (list m.match m.captures))
   (nil nil))

  ("match with regexp and capturing groups"
   (let m (string-match "  foo\b    bar" "(^\\s+)")
     (list m.match m.captures))
   ("  " ("  "))))

(examples-for string-pieces
  ("interpolates a string"
   "foobar ~(+ 1 2) you know"
   "foobar 3 you know"))

(examples-for joinstr
  ("joins elements into a string"
   (joinstr "" '("foo" "bar" "bax"))
   "foobarbax")

  ("joins separate elements into a string"
   (joinstr "/" "foo" "bar" "bax")
   "foo/bar/bax")

  ("joins a single thing"
   (joinstr "/" "foo")
   "foo")

  ("joins nested and separate elements into a string"
   (joinstr "/" "foo" "bar" '(twiddle diddle) "bax")
   "foo/bar/twiddle/diddle/bax")

  ("joins elements into a string"
   (joinstr " - " '(1 2 3))
   "1 - 2 - 3"))

(examples-for string-strip
  ("removes leading whitespace"               (string-strip "    hello!")  "hello!" )
  ("removes trailing whitespace"              (string-strip "(world)   ") "(world)" )
  ("removes leading and trailing whitespace"  (string-strip "\n\nme\n\n") "me"      ))

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nydp-0.1.11 lib/lisp/tests/string-tests.nydp
nydp-0.1.10 lib/lisp/tests/string-tests.nydp
nydp-0.1.9.1 lib/lisp/tests/string-tests.nydp
nydp-0.1.9 lib/lisp/tests/string-tests.nydp
nydp-0.1.8 lib/lisp/tests/string-tests.nydp