在Roku中使用SubString作为函数

时间:2019-11-29 05:53:06

标签: roku brightscript

我试图在Roku中获取角色。 在这里,我采用了一种静态方法并成功找到了字符串。

string = "HelloRokuIamHere"
if Instr(string, "Roku") > 0 then
   ?"String is Found"
else
   ?"String is Not Found"
end if

在这里,我得到了一个动态字符串。所以每次都不给静态值。所以,我试图像下面这样子字符串。有可能这样或其他方式吗?

string = "HelloRokuIamHere"
?"substring(string,5,8) ' here I tried to display "Roku"

1 个答案:

答案 0 :(得分:2)

在BrightScript中查找和提取子字符串的功能是main(),您可以使用Global String FunctionifStringOps Interface Function

用法

struct T;

int main(void)
{
    struct T * p = 0;
    return !!p;
}

// Later on you may define `struct T`