大家好,
这是我有的脚本。 我想知道是否有更好的方法来做同样的事情。
我首先使用“加载文本文件”将文本文件读入字符串变量“file_text1”。
接下来,我使用 "words" 和 "\!n" 来分隔行并将它们加载到字符串数组 "file_text2" 中。
接下来,我将“file_text2”加载到数据表中。 然后我使用“get rows where”结合“contains”来查找原始文本文件中包含某个字符串的行号。
是否有等效于“获取行的位置”但可用于字符串数组的函数? 这样,我可以跳过加载到数据表中的部分。
file_text1 = load text file( "example.txt" );
file_text2 = words(file_text1 , "\!n");
dt0 = new table("file_dt", new column("file_content", character) );
dt0:file_content << set values(file_text2);
pass_qty_row_array = dt0 << get rows where(contains( :file_dt, "Pass") );
pass_qty_row = pass_qty_row_array[1] + 1;