我怎么能写一个说以下(伪代码)的while循环:
While the index of "blahblah" in string 1 exists
do this
我怎么能写一个说以下(伪代码)的while循环:
While the index of "blahblah" in string 1 exists
do this
while(string1.Contains("blahblah")) {
// do this
}
成功编译为 C# 的伪代码。0 个错误,0 个警告。所用时间:0:00:01.860。
var string1 = "blahblah blahblah blahblah blahblah ";
int pos = -1;
while (0 >= (pos = string1.IndexOf("blahblah", pos + 1)))
{
// do this.
}