Jump to content

Recommended Posts

Posted

I found that if i add a long string that contains both delimiters "|" and @CRLF....the function will fail if the last element is blank, and the previous element ends with the row delimiter on line 109:

$aSplit_2 = StringSplit($aSplit_1[$i], $sDelim_Item, $STR_NOCOUNT + $STR_ENTIRESPLIT)

I can resolve the problem by telling my for loop not to add an extra @CRLF to the end of the string on the last pass.
another method would be to insert:

If UBound($aSplit_2,1)=0 Then ContinueLoop

just after line 109 in Array.au3

What is what? What is what.

Posted

Can you make a reproduction script ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

$aSplit_2 = StringSplit($aSplit_1[$i], $sDelim_Item, $STR_NOCOUNT + $STR_ENTIRESPLIT)
                    For $j = 0 To $iValDim_2 - 1
                        $aTmp[$i][$j] = $aSplit_2[$j]
                    Next
I think that UBound($aSplit_2) >= $iValDim_2 might not hold. If that's right, then the string "1|2 n 3" should be able to do that.

Edited by TypeIt
Posted

This will do it...
 

#Include <Array.au3>
Local $bEnableFix=False
Local $aTemp[0][12]
Local $TestString
For $iIndexX=0 To 10
    For $iIndexZ=0 To 10
        $testString&=$iIndexX&"|"
    Next
    If $bEnableFix And ($iIndexX=10) Then
        $testString&=$iIndexX
    Else
        $testString&=$iIndexX&@CRLF
    EndIf
Next
_ArrayAdd($aTemp,$testString)
_ArrayDisplay($aTemp)

What is what? What is what.

  • Moderators
Posted

Biatu,

The UDF is failing because of the final @CRLF. It fools the UDF into thinking there is another line to follow and as there is not it fails when trying to add the non-existent elements. :(

Thanks for the report - I have a fix and just need to test it. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Thank you and I understand the conflict, I exported the function and modified it to continueloop if there is no following data

What is what? What is what.

  • Moderators
Posted

Hi,

New function committed - so please test again when the next Beta is released. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...