是的,indexOf方法已经过时,可以使用std.algorithm模块中的find函数来实现。修改后的代码如下:

import std.algorithm; import std.stdio;

void main() { string str = "Hello, world!"; writeln(str.find("world")); }

dlang语言如下代码提示错误no property indexOf for str of type string代码如下import stdstdio;void main string str = Hello world!; writelnstrindexOfworld;上边代码是不是dmd1过时版本的写法请为我纠正或者给出最新代码

原文地址: https://www.cveoy.top/t/topic/fkjr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录