【发布时间】:2018-06-19 12:50:52
【问题描述】:
我在阅读 MCSD Certification Toolkit (Exam 70-483) 的书时发现了 OData 过滤字符串函数 bool substring(string p0, string p1)。
尝试在我的应用程序中使用它:
/Categories?$select=CategoryName&$filter=substring(CategoryName,'Seafood')
得到错误:
No function signature for the function with name 'substring' matches the specified arguments. The function signatures considered are:
substring(Edm.String Nullable=true, Edm.Int32);
substring(Edm.String Nullable=true, Edm.Int32 Nullable=true);
substring(Edm.String Nullable=true, Edm.Int32, Edm.Int32);
substring(Edm.String Nullable=true, Edm.Int32 Nullable=true, Edm.Int32);
substring(Edm.String Nullable=true, Edm.Int32, Edm.Int32 Nullable=true);
substring(Edm.String Nullable=true, Edm.Int32 Nullable=true, Edm.Int32 Nullable=true).
看起来所需的子字符串函数不见了?它在哪里?
我发现类似的功能很好用:
/Categories?$select=CategoryName&$filter=substringof(CategoryName,'Seafood')
【问题讨论】:
-
子字符串存在,但参数中不包含 2 个字符串:
string substring(string p0, int pos)或string substring(string p0, int pos, int length) -
查看 MSDN 文档,
substring从未将两个String对象作为参数。你确定这不仅仅是一个错字吗?
标签: c# rest web-services substring odata