Musashi Posted December 9, 2019 Share Posted December 9, 2019 Question : The StringStripWS function contains the statement, Flag : $STR_STRIPALL (8) = strip all spaces (over-rides all other flags) In the German forum @Professor_Bernd wrote me, that this is an incorrect description. A test we made revealed, that it seems to be exactly the other way around. $STR_STRIPALL gets overwritten by all other flags. Example : #include <StringConstants.au3> Local $sOriginal = " A sentence with whitespace. " , $sOutput ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) ConsoleWrite("+ Original : <" & $sOriginal & ">" & @CRLF) ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPLEADING) & ">") ConsoleWrite("> >>>>>>> 1. <" & $sOutput & "==> STRIPLEADING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPTRAILING) & ">") ConsoleWrite("> >>>>>>> 2. <" & $sOutput & "==> STRIPTRAILING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPSPACES) & ">") ConsoleWrite("> >>>>>>> 3. <" & $sOutput & "==> STRIPSPACES" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) & ">") ConsoleWrite("> >>>>>>> 4. <" & $sOutput & "==> STRIPLEADING + STRIPTRAILING + STRIPSPACES" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL) & ">") ConsoleWrite("> >>>>>>> 5. <" & $sOutput & "==> STRIPALL" & @CRLF) ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPLEADING) & ">") ConsoleWrite("! >>>>>>> 6. <" & $sOutput & "==> STRIPALL + STRIPLEADING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPTRAILING) & ">") ConsoleWrite("! >>>>>>> 7. <" & $sOutput & "==> STRIPALL + STRIPTRAILING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPSPACES) & ">") ConsoleWrite("! >>>>>>> 8. <" & $sOutput & "==> STRIPALL + $STR_STRIPSPACES" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) & ">") ConsoleWrite("! >>>>>>> 9. <" & $sOutput & "==> STRIPALL + STRIPLEADING + STRIPTRAILING + STRIPSPACES" & @CRLF) ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) Is this behavior already known, or have we possibly misunderstood something. Any clarification is welcome. TIA @Musashi and @Professor_Bernd "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
argumentum Posted December 9, 2019 Share Posted December 9, 2019 34 minutes ago, Musashi said: Is this behavior already known ..no clue myself. But I never thought of going higher than $STR_STRIPALL (8), nor would find a reason to. Nonetheless is unexpected and if you feel it needs correction you can open a ticket after searching if is there any open describing that. Musashi 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Musashi Posted December 9, 2019 Author Share Posted December 9, 2019 6 hours ago, argumentum said: But I never thought of going higher than $STR_STRIPALL (8), nor would find a reason to. I've never done that before as well, so my first answer was : "Since $STR_STRIPALL removes ALL blanks, the statement "over-rides all other flags" seems logical to me. Example: $STR_STRIPALL + $STR_STRIPLEADING ==> with $STR_STRIPALL there are no more leading spaces to remove." However, the test (see above) has shown that $STR_STRIPALL will be ignored, if one of the other flags is set. Perhaps it is just a misinterpretation of the word over-rides, as @BugFix suspects (in the DE forum). For me over-rides all other flags means, that $STR_STRIPALL has a higher priority than the other flags - but maybe I'm wrong. I'll wait and see what e.g. @Jos has to say about that, before I open a ticket. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Musashi Posted December 9, 2019 Author Share Posted December 9, 2019 11 hours ago, Musashi said: For me over-rides all other flags means, that $STR_STRIPALL has a higher priority than the other flags .... I'll wait and see what e.g. @Jos has to say about that, before I open a ticket. Just for the record : The description "over-rides all other flags" is, strictly taken, not correct (by the way : shouldn't it be written "overrides" ?) However, as @argumentum already pointed out, there is no practical reason to combine $STR_STRIPALL with the other flags. We will therefore only replace the text of the german Help, from (translated) "over-rides all other flags" with "the use of the other flags is obsolete". The whole issue is of little importance anyway (no need for a ticket). . "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." 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