Search code examples
stringkdb

Adding Strings in KDB+


I am new to KDB+ and q and want to know how I would go about adding two strings to make a sentence.

For example how would I join w1:"Hello" to w2:"World" to make the new string "Hello World"


Solution

  • So there are two ways you could go about doing it. The first is to use the join operator (,), like so

    w1 , " " , w2
    

    or you could use the scalar-from-vector function (sv), like so

    " " sv (w1; w2)
    

    If you want to learn a bit more about kdb+/q, then Q for Mortals is a great reference.