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

New to Autoit Syntax - String Parsing

$
0
0
Good Day,
I have a tag inside a HTML file needs parsing.

TAG

<div class="W3 Schools Link WHITESPACES " title="Hello World	"></div>

CURRENT METHOD
[ autoit ]      
$Delim1=StringSplit($tagsParameters, ' ') ; ...I did not account for this reaction initially =/ For $k = 1 to $Delim1[0] If $Delim1[$k] = '' then ; catch empty strings Else $Delim2 = StringSplit($Delim1[$k], '=') For $l = 1 to $Delim2[0] $KeyValue = $Delim2[1] ; *** KEY VALUE NAME *** $KeyParameter = $Delim2[2] ; *** KEY PARAMETER VALUE *** Next $KeyParameter = StringReplace($KeyParameter, '"', "") EndIf Next
I'm a moron of course, not compensating for all those " SPACES"


FUTILE ATTEMPTS
[ autoit ]      
$DelimX = StringSplit($tagsparameters, '="') For $l = 1 to $DelimX[0] $KeyValue = $DelimX[1] ; *** KEY VALUE NAME *** $KeyParameter = $DelimX[3] ; *** KEY PARAMETER VALUE *** Next msgbox(0, '', 'Key Value Name: '&$KeyValue&@LF&'Key Parameter: '&$KeyParameter)
This of course does not work because 'title="Hello World "' exist in array[4]
I can't seem to remember how to get For $x = 1 to $arr[0][0] to cooperate properly.

I'm overlooking something I already know the answer to, but too many hours staring at this screen has made me biased.
The function was made completely adbsent-minded of the fact that there would be spaces in quoted strings.
To much of THIS_AndThatAndThisAndThat again, has made me lazy.

Regex solutions are fine but I would prefer to keep it as is.

Thank You & Regards,
UnKnOwned

Viewing all articles
Browse latest Browse all 12506

Trending Articles



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