public class CustomFunctionExtension extends Object implements org.ssssssss.script.functions.ExtensionMethod
ExtensionMethod
构造器和说明 |
---|
CustomFunctionExtension() |
限定符和类型 | 方法和说明 |
---|---|
Class<?> |
support()
扩展String方法
|
Integer |
toInt(String str)
方法参数至少有一个,且第一个参数必须为support方法返回的类型
以将字符串转为int为例,该方法编写如下,最终调用时使用strVar.toInt()调用
该方法第一个参数会自动被传入,所以调用时无需传入
var str = '123';
//以下两种方式都支持
return '1234'.toInt();
//return str.toInt();
|
public Class<?> support()
support
在接口中 org.ssssssss.script.functions.ExtensionMethod
@Comment(value="\u5c06\u5b57\u7b26\u4e32\u8f6c\u4e3aInteger(\u65b9\u6cd5\u540d\u7684\u63d0\u793a)") public Integer toInt(String str)
Copyright © 2025. All rights reserved.