函数 startsWith() 可以计算一个字符串是否以指定的词头为开头,并返回 1(是)、0(否)。
Arguments:
- 字符串 <string>
- 词头 <string>
Returns:
- 判断结果 <number>
一般用法
示例:异源别名直接计算
uncollect ["Ultipa", "ULTIPA.com"] as a
uncollect ["Ul", "UL"] as b
return table(a, b, startsWith(a, b))
| a | b | startsWith(a, b) |
|------------|----|------------------|
| Ultipa | Ul | 1 |
| ULTIPA.com | UL | 1 |
示例:异源别名笛卡尔积后计算
uncollect ["Ultipa", "ULTIPA.com"] as a
uncollect ["Ul", "UL"] as b
with startsWith(a, b) as c
return table(a, b, c)
| a | b | c |
|------------|----|---|
| Ultipa | Ul | 1 |
| Ultipa | UL | 0 |
| ULTIPA.com | Ul | 0 |
| ULTIPA.com | UL | 1 |