Modify

Opened 10 years ago

Closed 7 years ago

#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 Changed 10 years ago by Jpm

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 Changed 10 years ago by mvg

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 Changed 10 years ago by mvg

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 Changed 10 years ago by Jpm

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 Changed 7 years ago by Jon

  • Resolution set to Rejected
  • Status changed from new to closed

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 ticket will remain with no owner.
Author


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

 
Note: See TracTickets for help on using tickets.