将字符串与 kdb+ q 中的数字连接

问题描述 投票:0回答:1

我可以在字符串后附加数字。

temp:30
text:"Current temperature is ",string temp
show text
type text

结果

"Current temperature is 30"
10h

但是,如果我再追加一个字符串,它就会变成一个列表。 (为什么?)

text:"Current temperature is ",string temp," degree celsius"
show text
type text

结果

C
u
r
r
e
n
t
 
t
e
m
p
e
r
a
t
u
r
e
 
i
s
..
0h

我可以使用

sv
和空字符串作为分隔符,这是正常的方法吗?

text:"" sv ("Current temperature is ";string temp;" degree celsius")
kdb q
1个回答
0
投票

comma operator
concatenated string
中的每个字符视为单独的项目,并创建这些字符的
list

另一方面,当您使用

sv
并以空字符串作为分隔符时,它将列表中的所有字符串连接成一个字符串,这是连接所需的行为。

© www.soinside.com 2019 - 2024. All rights reserved.