kdb String Functions
kdb provides the following String manipultation functions:
sym | description | syntax | eg |
---|---|---|---|
like | Perform simple pattern matching of strings. | like[text; pattern] | like[("kim";"kyle";"Jim"); "k*"] |
lower | Monadic that converts strings and symbols to lower case | lower[text] | `small~lower `SMALL |
ltrim | Monadic that removes leading whitespace from strings. | ltrim[text] | "abc"~ltrim " abc" |
rtrim | Monadic that removes trailing whitespace from strings. | rtrim[text] | "abc"~rtrim "abc " |
ss | The function ss finds positions of a substring within a string. It also supports some pattern matching capabilities of the function like: | r:HayStack ss needle | "toronto ontario" ss "ont" |
ssr | The function ssr does search and replace on a string. | r:ssr[haystack; needle; replacement] | ssr["toronto ontario"; "ont"; "XX"] |
sv | When applied to a vector of strings it returns the elements of its right argument-the list of strings-separated by the left argument. | "|" sv ("asdf";"hjkl") | |
trim | Monadic that removes leading and trailing whitespace from strings. | trim[text] | "abc"~trim " abc " |
upper | Monadic that converts strings and symbols to upper case | lower[text] | `BIG~upper `big |
vs | With a character or a string on the left hand side, it tokenizes a string on the right hand side using the left hand side as the specified delimiter. It returns a vector of substrings. | ","vs"one,two,three" |