Opened 12 years ago
Closed 12 years ago
#2290 closed Bug (No Bug)
String functions fails on a file
Reported by: | FireFox | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.9.4 | Severity: | None |
Keywords: | StringReplace StringSplit | Cc: |
Description
I wanted to replace a simple string on the file "au3.keywords.properties" (the one included in the SciTE4AutoIt3 package) and I realised that it replaced only one instance whereas there is actually two.
I have checked the count of this instance with the function StringSplit and it totally fails as it returns 34710.
Here is an example :
#include <Array.au3> $sSciTEDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\SciTE\" $sRead = FileRead($sSciTEDir & "\Properties\au3.keywords.properties") ;~ ConsoleWrite($sRead & @CrLf) ConsoleWrite(StringLen($sRead) & @CrLf) $aSplit = StringSplit($sRead, "_singleton") ;~ _ArrayDisplay($aSplit) $sReplace = StringReplace($sRead, "_singleton", "_singleton " & "_singletonW") ConsoleWrite("replacements: " & @extended & ", count: " & $aSplit[0] & @CrLf) ;~ FileWrite($sSciTEDir & "\Properties\au3.keywords.properties", $sReplace)
Tested on lastest production and beta.
Running on Windows 7 SP1 32bits.
Attachments (0)
Change History (3)
comment:1 Changed 12 years ago by guinness
comment:2 Changed 12 years ago by FireFox
Epic fail. Seems like I have made tons of mistakes that I believed there was a bug.
Sorry, you can close this.
comment:3 Changed 12 years ago by trancexx
- Resolution set to No Bug
- Status changed from new to closed
Please be serious with bug reporting next time.
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.
There is only one instance of _singleton in that file (using the latest from June '12) and you need to set the flag option to 1 if you want the return value of StringSplit to be 2 (or in your case 3.) As far as I can tell this isn't a bug.