我正在读一个文本文件,一旦找到一个特定的字符串,我想退出for循环。
for@i=0 to 100
if(string="0800")
//execute code
if(string="0900")
//execute code
然后我想执行另一个仍然读取相同文本文件但仍在寻找不同参数的for循环。
for@i=0 to 100
if(string="SAN DIEGO")
//execute code
if(string="SAN FRANCISCO")
//execute code
一个for循环搜索特定小时,另一个for循环搜索特定名称。
这是文本文件格式的示例:
0800
SAN FRANCISCO
0900
SAN DIEGO
1600
OAKLAND
*请注意,小时和名称是相关联的。即0800与SAN FREGISCO,0900与SAN DIEGO,....
如何以最有效的方式进行设置?
我想这就是你要找的东西,但我不确定
for@i=0 to 100
if(string="0800")
if(string="SAN DIEGO")
//execute code
if(string="SAN FRANCISCO")
//execute code
if(string="0900")
if(string="SAN DIEGO")
//execute code
if(string="SAN FRANCISCO")
//execute code