orbs Posted March 10, 2015 Share Posted March 10, 2015 #include <String.au3> Global $iLength = 99999 ; change it to whatever, as long as it's longer than the insert point Global $iInsert = 65536 ; insert point 65536 => not working, and no @error. change it to 65535 => OK Global $s1 = _StringRepeat('a', $iLength) $s1 = _StringInsert($s1, 'b', $iInsert) ConsoleWrite( _ '@error = ' & @error & @LF & _ 'Length = ' & StringLen($s1) & @LF & _ 'Char = ' & StringMid($s1, $iInsert + 1, 1) & @CRLF) issue is quite simple really, title and code above speaks for itself. i'm just trying to make sure i'm not missing the obvious before submitting a ticket. issue exists in AutoIt v3.3.12.0 & v3.3.10.2, as well as latest Beta. issue does not exist in AutoIt v3.3.8.1 there was a major rewrite of this function after v3.3.8.1, but it's now using StringRegExpReplace, which i'm not comfortable with. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 10, 2015 Moderators Share Posted March 10, 2015 orbs,I can confirm the bug. >It seems to be a limitation of the PCRE engine which means that it cannot deal with quantifiers greater than 65535. Here is an illustration:#include <String.au3> Global $iLength = 99999 Global $sString = _StringRepeat('a', $iLength) Global $iInsert = 65535 $sOne = StringRegExpReplace($sString, "(?s)\A(.{" & $iInsert & "})(.*)\z", "$1") $sTwo = StringRegExpReplace($sString, "(?s)\A(.{" & $iInsert & "})(.*)\z", "$2") ConsoleWrite($iInsert & " : " & StringLen($sOne) & " - " & StringLen($sTwo) & @CRLF) Global $iInsert = 65536 $sOne = StringRegExpReplace($sString, "(?s)\A(.{" & $iInsert & "})(.*)\z", "$1") $sTwo = StringRegExpReplace($sString, "(?s)\A(.{" & $iInsert & "})(.*)\z", "$2") ConsoleWrite($iInsert & " : " & StringLen($sOne) & " - " & StringLen($sTwo) & @CRLF)As you can see, the long string is not cut when the $iInsert value is greater than 65535. I will discuss it with the Devs. M23 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
czardas Posted March 10, 2015 Share Posted March 10, 2015 (edited) Try this version: ; ; #Function# =================================================================================================================== ; Author ........: Louis Horvath <celeri at videotron dot ca> ; Modified ......: czardas - (re-write for optimization), jchd (removed explicit checks on string parameters) ; ============================================================================================================================== Func _StringInsert_MOD($sString, $sInsertString, $iPosition) ; Retrieve the length of the source string Local $iLength = StringLen($sString) ; Casting Int() takes care of String/Int, Numbers $iPosition = Int($iPosition) ; Adjust the position to accomodate negative values (insertion from the right) If $iPosition < 0 Then $iPosition = $iLength + $iPosition ; Check the insert position is within bounds If $iLength < $iPosition Or $iPosition < 0 Then Return SetError(1, 0, $sString) ; Insert the string Return StringLeft($sString, $iPosition) & $sInsertString & StringRight($sString, $iLength - $iPosition) EndFunc Edited March 10, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 10, 2015 Moderators Share Posted March 10, 2015 (edited) orbs,And as you can see the problem had already been solved and just awaits a new Beta release. M23 Edited March 10, 2015 by Melba23 Typo 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now