Pancode - Commands - String Operations

These are various commands which operate on strings. Some of these will also work on lists, where it makes sense to do so. These cases are explicitly mentioned when they occur. Note that some of the list commands also apply to strings.

Concatenate (β‹„)

Takes two strings or lists and returns a new string or list which is the concatenation of the two. The two must have the same type. Subject to binary extension. If given a numerical modifier of zero or a ⚐ argument, returns the empty string.

If given lists and any of the input lists is lazy, then the resulting list will be lazy.

Chr / Ord (πŸ’¬)

Expects either a number, string, or list as an argument, and performs an appropriate operation based on the type of its argument. If given a number, returns a string consisting of the character whose code point is that value. If given a list, returns a string whose characters have code points equal to each value in the list. If given a string, returns the (eager) list of code points.

Chomp (🍴)

Takes a string argument and removes the final character if that character is a newline. If not, the string is returned unmodified. Subject to scalar extension.

Mark as Regexp (r)

Takes a string and returns a new string identical to the first but marked as a regular expression. This string behaves identically to the original for most purposes, but if used in a command which involves searching or replacing, it will be treated as a regular expression rather than a literal string.

Split String (ΒΆ)

Takes two arguments: a string and a delimiter. The delimiter can be either a string or a regular expression. The string is split based on the delimiter, and an eager list of strings is returned.

Join String (⁋)

Takes a list and a delimiter. Each element of the list is prettified, then they are joined together, using the delimiter (which must be a string) in between each pair of adjacent elements.

Prettify (p)

Takes a single argument and converts it to a string in a natural way. If the argument is already a (non-regexp) string, it will not be changed.

Documentation Index