Modify

Opened 4 years ago

Closed 3 years ago

#2671 closed Bug (Fixed)

StringSplit - bug : Delimiter case sensitivity problem

Reported by: mlipok Owned by: Jon
Milestone: 3.3.13.10 Component: AutoIt
Version: 3.3.11.3 Severity: None
Keywords: Cc:

Description

Repro:

#include <MsgBoxConstants.au3>
#include <array.au3>
Local $sData1 = "NR KONTA: 47 1020" & @CRLF & _
        "NR KONTA: 62 2030" & @CRLF & _
        "NR KONTA: 64 1910" & @CRLF & _
        "NR KONTA: 30 2030" & @CRLF & _
        "NR KONTA: 03 1020" & @CRLF & _
        "NR KONTA: 77 1020" & @CRLF & _
        "NR KONTA: 35 1090" & @CRLF & _
        "NR KONTA: 28 1240" & @CRLF & _
        "NR KONTA: 07 1020" & @CRLF & _
        "NR KONTA: 29 1240" & @CRLF & _
        ""

Local $sData2 = StringReplace($sData1, "NR KONTA: 62 2030", "Nr KONTA: 62 2030")
ClipPut($sData2)

Local $aTest1 = StringSplit($sData1, 'NR KONTA:', 1)
_ArrayDisplay($aTest1, '$aTest1')

Local $aTest2 = StringSplit($sData2, 'NR KONTA:', 1)
_ArrayDisplay($aTest2, '$aTest2')

Local $aTest3 = StringSplit($sData2, 'Nr KONTA:', 1)
_ArrayDisplay($aTest3, '$aTest3')

If $aTest1[$aTest1[0]] <> $aTest2[$aTest2[0]] Then
    MsgBox($MB_SYSTEMMODAL, "Question", " Why ? " & @CRLF & " $aTest1[$aTest1[0]] <> $aTest2[$aTest2[0]] " & @CRLF & $aTest1[$aTest1[0]] & " <> " & $aTest2[$aTest2[0]], 10)
EndIf

If $aTest1[2] == $aTest2[2] and $aTest1[3] == $aTest2[3] Then
    MsgBox($MB_SYSTEMMODAL, "Question", "Why second and third element in $aTest1 and $aTest2 are still the same ?", 10)
EndIf

MsgBox($MB_SYSTEMMODAL, "Question", "Why $aTest3 contains so little data ?", 10)



$sData1 = StringReplace($sData1, " KONTA:", "_KONTA:")
$sData2 = StringReplace($sData1, "NR_KONTA: 62 2030", "Nr_KONTA: 62 2030")


MsgBox($MB_SYSTEMMODAL, "New $sData1 Content", $sData1, 10)
MsgBox($MB_SYSTEMMODAL, "New $sData2 Content", $sData2, 10)
Local $aTest = StringSplit($sData1, @CRLF, 1)
_ArrayDisplay($aTest1, 'New $aTest')

Local $aTest1 = StringSplit($sData1, 'NR_KONTA:', 1)
_ArrayDisplay($aTest1, 'New $aTest1')

Local $aTest2 = StringSplit($sData2, 'NR_KONTA:', 1)
_ArrayDisplay($aTest2, 'New $aTest2')

Local $aTest3 = StringSplit($sData2, 'Nr_KONTA:', 1)
_ArrayDisplay($aTest3, 'New $aTest3')

Discusion:

http://www.autoitscript.com/forum/topic/159807-stringsplit-strange-behavior-or-bug/

Attachments (1)

test_Split.au3 (1.2 KB) - added by mlipok 4 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by FireFox

  • Summary changed from StrringSplit - bug : StringSplit($sData1, @CRLF, 1) to StringSplit - bug : StringSplit($sData1, @CRLF, 1)

comment:2 Changed 4 years ago by mlipok

one Typo in repro

BAD:

Local $aTest = StringSplit($sData1, @CRLF, 1)
_ArrayDisplay($aTest1, 'New $aTest')

GOOD:

Local $aTest = StringSplit($sData1, @CRLF, 1)
_ArrayDisplay($aTest, 'New $aTest')

comment:3 Changed 4 years ago by mlipok

NEW FULL CLEAN REPRO

#include <Array.au3>
Local $sData1 = "0AB1Ab2aB3ab4Ab5AB6"

Local $aTest1 = StringSplit($sData1, 'ab', 1)
_ArrayDisplay($aTest1, '$aTest1')
#cs Current AutoIt 3.3.11.3 Results :
    Row|Col 0
    [0]|2
    [1]|0AB1Ab2
    [2]|3
#CE
#CS expected result :
    Row|Col 0
    [0]|2
    [1]|0AB1Ab2aB3
    [2]|4Ab5AB6
#CE

Local $aTest2 = StringSplit($sData1, 'aB', 1)
_ArrayDisplay($aTest2, '$aTest2')
#CS Current AutoIt 3.3.11.3 Results :
    Row|Col 0
    [0]|2
    [1]|0AB1Ab2
    [2]|3
#CE
#CS expected result :
    Row|Col 0
    [0]|2
    [1]|0AB1Ab2
    [2]|3ab4Ab5AB6
#CE


Local $aTest3 = StringSplit($sData1, 'Ab', 1)
_ArrayDisplay($aTest3, '$aTest3')
#CS Current AutoIt 3.3.11.3 Results :
    Row|Col 0
    [0]|3
    [1]|0
    [2]|1
    [3]|2aB3ab4
#CE
#CS expected result :
    Row|Col 0
    [0]|3
    [1]|0AB1
    [2]|2aB3ab4
    [3]|5AB6
#CE

Local $aTest4 = StringSplit($sData1, 'AB', 1)
_ArrayDisplay($aTest4, '$aTest4')
#CS Current AutoIt 3.3.11.3 Results :
    Row|Col 0
    [0]|3
    [1]|0
    [2]|1
    [3]|2aB3ab4
#CE
#CS expected result :
    Row|Col 0
    [0]|3
    [1]|0
    [2]|1Ab2aB3ab4Ab5
    [3]|6
#CE

ps.
if this ticket was a little annoying in its form, I'm sorry

comment:4 Changed 4 years ago by mlipok

after all please change the ticket title to:
"StringSplit($sData, $delim, 1) : case sensitivity issue in $delim"

Changed 4 years ago by mlipok

comment:5 Changed 4 years ago by Melba23

  • Summary changed from StringSplit - bug : StringSplit($sData1, @CRLF, 1) to StringSplit - bug : Delimiter case sensitivity problem

comment:6 Changed 3 years ago by Jon

  • Milestone set to 3.3.13.10
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [10469] in version: 3.3.13.10

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jon.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.