Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

stringsplit ignore line if nothing to split?

$
0
0
hey guys,

I'm using stringsplit to parse a log file, and I've run into a slight issue. if the delimiter does not exist in one of the lines, the program crashes when it reaches that line. is there a way for the stringsplit to leave the line alone if it doesn't find the delimiter.

thanks

snippet code:

[ autoit ]      
_FileReadToArray($logdir, $aLog) for $i = 1 to $aLog[0] $aLog_WS = StringStripWS($aLog[$i], 8) $aRu_Split = StringSplit ($aLog_WS, "]") ; _ArrayDisplay($aRu_Split) GUICtrlSetData($Edit1, "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] " & "in statement" &@CRLF, 1) If StringInStr($aRu_Split[2],"вв") Then ;$aRU_split [2] = "вв" doesnt work for some reason GUICtrlSetData($Edit1, "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] " & "found, restarting" &@CRLF, 1) FileClose($logdir) sleep(100) $found = 1 GUICtrlSetData($num, $wincount) failcheck() ExitLoop EndIf

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>