Modify

#1832 closed Bug (Rejected)

StringStripCR(): Clips strings at NUL-character.

Reported by: mvg Owned by:
Milestone: Component: AutoIt
Version: 3.3.6.1 Severity: None
Keywords: StringStripCR nul null zero Cc:

Description

Problem taken from ticket #1831

	Local $sString = 'aa' & Chr(0) & 'A  A' & @CR
	ConsoleWrite('StringLen($sString) = ' & StringLen($sString) & @CRLF) ;; [8]
	ConsoleWrite('StringLen(StringStripCR($sString)) = ' & StringLen(StringStripCR($sString)) & @CRLF) ;; [2], would be [7] if not cliped at null-character.
	;; just picking a similar function to see if its supporting in-string nul character.
	ConsoleWrite('StringLen(StringStripWS($sString,8)) = ' & StringLen(StringStripWS($sString,8)) & @CRLF) ;; [5], would be [2] if cliped at null-character.

Attachments (0)

Change History (5)

comment:1 by J-Paul Mesnage, on Dec 10, 2010 at 12:45:38 PM

I can add that StringStripWS() does not remove chr(0) as stated in the doc
Not sure if StringStripCR() should support Chr(0) not stripping.

comment:2 by mvg, on Dec 10, 2010 at 3:36:38 PM

I missed the StringStripWS() doc part on StringStripWS() also removing chr(0).

Don't mind knowing(also) what the general consensus is with chr(0) in relation to the string* group functions. If there is any of course.

Valik?

comment:3 by mvg, on Dec 11, 2010 at 5:07:46 PM

Run trough the string group functions. Looking at there behavior in relation to CHR(0) characters.
(adding for reference.)

cliped at (output result is based on the input string up to the first chr(0) character.)
StringIsAlNum
StringIsAlpha
StringIsASCII
StringIsDigit
StringIsFloat
StringIsInt
StringIsLower
StringIsSpace
StringIsUpper
StringIsXDigit
StringAddCR
StringStripCR
StringFormat

ignored/used (chr(0) is handles just like other characters.)
StringLen
StringLower
StringUpper
StringLeft
StringRight
StringTrimLeft
StringTrimRight
StringMid
StringInStr
StringStripWS (*)
StringCompare
StringToASCIIArray (*)
StringFromASCIIArray (*)
StringSplit
StringReplace

mixed/not_done
StringRegExpReplace
StringRegExp

*)has some Chr(0) info in doc.

  • - -

    I can add that StringStripWS() does not remove chr(0) as stated in the doc.

+1 (although I don't know if there is any real need to refer to chr(0) here if chr(0) is not removed by StringStripWS().)

Not sure if StringStripCR() should support Chr(0) not stripping.

As StringAddCR() is also clipping strings at chr(0) you probably right.
Its not that StringAddCR() and StringStripCR() can't be easily duplicated, but then without clipping at chr(0) if needed, with StringReplace() itself.
(assuming StringAddCR() and StringAddCR() might be speed optimized linefeed modifiers/function.)

Think thats it from me on this one.

comment:4 by J-Paul Mesnage, on Dec 13, 2010 at 10:49:47 AM

That's an fantastic analysis.
I think the support of Chr(0) in string is what we wanted to use basic String...() builtin on such string.
For me StringStripWS() should clip as it is not a basic one.
For StringToASCIIArray() and StringFromASCIIArray(), It can be considered as a basic builtin.
Definitely Doc must be updated to reflect the support/Clipping.

comment:5 by Jon, on Jul 21, 2013 at 11:31:57 PM

Resolution: Rejected
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.