Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/12/2016 in all areas

  1. A universal Swap-func swapping 2 Values from each var, arraytype: #include<array.au3> local $a = [["00" , "01" , "02"],["10" , "11" , "12"],["20" , "21" , "22"]] _ArrayDisplay($a) _swap($a[2][1] , $a[0][2]) _ArrayDisplay($a) Func _swap(ByRef $1 , ByRef $2) Local $Tmp = $1 $1=$2 $2=$Tmp EndFunc also 2 elements of 2D array
    1 point
  2. Local $sExample = "This" & @CRLF & @CRLF & "is an example." & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "This is another line" & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "with some extra" & @CRLF & @CRLF & @CRLF & @CRLF & "line breaks." & @CRLF $sFrmt = StringRegExpReplace(stringstripCR($sExample) , "\n+" , @LF )  ;strip carraige returns, any time there is more than one line feed, replace that group with a single @LF msgbox(0, '' , $sFrmt)
    1 point
  3. Alright, how about this. We'll use a loop that will continue to execute while there are still multiple @CRLF@CRLFs in the string. ; Our example string Local $sExample = "This" & @CRLF & @CRLF & "is an example." & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "This is another line" & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "with some extra" & @CRLF & @CRLF & @CRLF & @CRLF & "line breaks." & @CRLF ; Create your variable that will be used for the while loop Local $iCrlf2 = StringInStr($sExample, @CRLF & @CRLF) ; $iCrlf2 is the index in the string where @CRLF&@CRLF is. If it's in the string then it will be > 0, if it's not then $iCrlf2 will be 0 ; and the loop will exit While ($iCrlf2) ; Replace the double @CRLF with a single @CRLF ; I.e., there is @CRLF & @CRLF & @CRLF in one spot, this will replace the first instance of @CRLF & @CRLF with only 1 @CRLF, ; thus making 3x@CRLF turn into 2x@CRLF. When the loop executes again, that 2x@CRLF now becomes 1x@CRLF $sExample = StringReplace($sExample, @CRLF & @CRLF, @CRLF) ; Update $iCrlf2 with the new index in the string $iCrlf2 = StringInStr($sExample, @CRLF & @CRLF) WEnd ConsoleWrite($sExample & @LF) Hopefully my comments make sense. The loop will execute when it finds 2x@CRLF in a row. It will then replace the 2x@CRLF with 1x@CRLF. So all multiple instances of @CRLF next to each other will be subtracted by one on each pass through. Take, for instance, the first long @CRLF chain. 7 line feeds. On the first pass through it will replace the first 2x@CRLF with one, so it will subtract one from the chain making it 6. Continueing to do this while there are still 2x@CRLF in the string.
    1 point
  4. Global $sExample = "This" & @CRLF & @CRLF & "is an example." & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "This is another line" & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "with some extra" & @CRLF & @CRLF & @CRLF & @CRLF & "line breaks." & @CRLF ConsoleWrite("=================Before=================" & @LF & $sExample & @LF & "=================Before=================" & @LF) $sExample = StringRegExpReplace($sExample, "(?m)(\r\n){2,}", @CRLF) ConsoleWrite("=================After=================" & @LF & $sExample & @LF & "=================After=================" & @LF)
    1 point
  5. How could something like that work? The file needs to be downloaded by someone (API or you) to calculate hash.
    1 point
  6. JohnOne

    about dllcall help me!

    $struct = DllStructCreate("char UID [21]; char IP [16]; ushort port ; char DeviceName [132]; char Reserved") DllCall("IOTCAPIs.dll", "int", "IOTC_Lan_Search2_Ex", "struct*", DllStructGetPtr($struct), "int", $ArrayLen, "int", $nWaitTimeMs, "int", $nSendIntervalMs) Maybe
    1 point
×
×
  • Create New...