i receive a strange result from splitting strings elements contained in an array .(In attachment the resulting array)
My Array contains strings like:
INFO [26.01.2018 13:53:44] [XYZ] [XYZ, XYZ] Delta pack 5.2.25_17.01.2018 server version: 5.2.25_22.01.2018 not available. My code is:
For $a=0 to UBound($Array_info_4) -1 $Array_info_4[$a]=StringSplit($Array_info_4[$a],",",$STR_NOCOUNT) Next I tried also using a second Array to store the result, but the result was the same, like in the attachment.
Where is my mistake? :-)
The McAfee return for AV defs per "C:\Progra~1\Common~1\McAfee\SystemCore\csscan.exe -Versions" is ...
CommonShell Command Line Scanner Lite (VSCORE.126.96.36.19960)
Engine version: 5800.7501
DAT version: 8450.0
Time required: 15 milliseconds
I want to isolate the actual DAT version as "8450.0". There may be an easier way to get the DAT Version via other McAfee or registry methods but essentially I just want to know how to parse a string at a character or @CRLF into two separate strings for further parsing. Example:
$string = "Name=Microsoft Windows 10 Professional |C:\windows|\Device\Harddisk0\Partition2"
Parse into $var1 = "Name" & $var2 = "Microsoft Windows 10 Professional |C:\windows|\Device\Harddisk0\Partition2"
From there I'd like to parse $var2 at "|" into $var3 = "Microsoft Windows 10 Professional" and $var4 "C:\windows|\Device\Harddisk0\Partition2"
I've encountered a strange problem while adding files (or rather file names) to a ListView.
Mechanics are simple:
1. Select files to add (FileOpenDialog + Multiselect)
2. Split selected string (filepath) into array (StringSplit)
3. File names appear on ListView (GUICtrlCreateListViewItem)
Writing starts from second array (since 0 is array size, and 1 is filepath).
Problem occurs when I try to add one file. Then, no filenames are added.
As far as I know, selecting one file generates only 2 strings (0 and 1) to split, therefore no string is written into ListView.
Is there any way / workaround to make this thing work properly?
Some code here:
While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idAddTest $sMessage = "Select test cases to load:" $sFileOpenDialog = FileOpenDialog($sMessage, @WorkingDir & "\data\tests\", "All (*.*)", $FD_FILEMUSTEXIST & $FD_MULTISELECT) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No test(s) were selected.") FileChangeDir(@ScriptDir) Else FileChangeDir(@ScriptDir) $aFileList = StringSplit($sFileOpenDialog, "|", @CRLF) For $i = 2 to $aFileList MsgBox( 0, "test", $aFileList[$i]) ;just for testing purposes GUICtrlCreateListViewItem($aFileList[$i], $idTestCaseList) Next EndIf EndSwitch WEnd
And nothing more spectacular from ListView side:
Global $idTestCaseList = GUICtrlCreateListView("List of Tests ", 24, 24, 225, 502, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) GUICtrlSetTip(-1, "List of test cases."& @CRLF &"Hold CTRL to select multiple lines.")
Any help appreciated!
How to use regular expressions in StringSplit and StringInStr
12 where is a simple StringSplit at delimeter example please?
Copy to clipboard #include <MsgBoxConstants.au3> Example() Func Example() Local $aDays = StringSplit("Mon,Tues,Wed,Thur,Fri,Sat,Sun", ",") ; Split the string of days using the delimeter "," and the default flag value. #cs The array returned will contain the following values: $aDays = "Mon" $aDays = "Tues" $aDays = "Wed" ... $aDays = "Sun" #ce For $i = 1 To $aDays ; Loop through the array returned by StringSplit to display the individual values. MsgBox($MB_SYSTEMMODAL, "", "$aDays[" & $i & "] - " & $aDays[$i]) Next EndFunc ;==>Example I went through Datatypes Operators Conditional Obj Statements I had high hopes for Obj statements but it was a waste so I went to Google, Yahoo, Yandex, Sohu, and Baidu.
All I learned is that Baidu has more mobile customers than the US has people!
I need to separate this string at each to enter into a database
ALL three examples are ARRAYS.... If I wanted a tree I go to the beach and catch a fish and plant it
deep with lots of tree food. Then water it daily waiting for the day the fish turns into a tree.
Is it a joke? I did a search array in the help(Help control 6.1) file for array and got NO RESULTS.
I tried the trim examples and they worked great but I have no way of knowing how long each string will be at the delimeter
so where is a simple StringSplit at delimeter example please? I know I had to miss it.