我在下面的输出中得到
null
。
规格
[
{
"operation": "shift",
"spec": {
"f($;$ = $.A.charAt(2) )": "charAt"
}
}
]
输入:
[
{
"A": "Active"
}
]
预期产出:
{
"charAt": "t"
}
没有这样的函数叫做 charAt,此外这些函数不能在 shift 转换中使用。
您可以使用 modify 转换规范以及 elementAt 函数,例如
[
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"A": "=split('',@(1,&))", // convert the string into an array of letters which constructs it
"charAt": "=elementAt(2,@(1,A))"
}
}
},
{
"operation": "remove",
"spec": {
"*": {
"A": "" // get rid of the reformed array
}
}
}
]
它将返回文字
t
中的字母A
,只要索引从2
开始
网站上的demo