我怎么能写一个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.
}