Search the Community
Showing results for tags 'clean control char'.
-
Hello, I'm comming from the french site "Autoitsript.fr" with the following question or problem. I try to use StringStripWS to clean spaces and control characters in a string. Here is my code. #include <String.au3> #include <StringConstants.au3> #include <Array.au3> ;---- Part 1 Local $sText = @TAB & "This is a new story." & @CR & @LF & "Once upon a time ... " Local $sCheck = "" $sCheck = StringStripWS($sText, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING, $STR_STRIPSPACES)) ;$sCheck = StringStripWS($sText, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) ConsoleWrite($sCheck & @CRLF) For $i = 1 to stringlen($sCheck) ConsoleWrite(stringmid($sCheck,$i,1) & "-" & Asc(stringmid($sCheck,$i,1)) & @CRLF) next ; Part 2 --- Workarround submited by "jchd" on he french site Local $sText = @TAB & " This is a new story." & @CR & @LF & "Once upon a time ... " Local $sCheck = StringStripWS(StringRegExpReplace($sText, "[[:space:]]+", " "), $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) ConsoleWrite(">" & $sCheck & "<" & @LF) _ArrayDisplay(StringToASCIIArray($sCheck)) The help file tells : But if we check the console after program execution , the CarriageReturn (Chr(13) is still there. This is a mistake of the program, a bug or a feature of StringStripWS or a mistake in the help file. I use AutoIt v3.3.14.5. We have already a workaround (Part 2). Thanks in advance for your replies.
- 9 replies
-
- stringstripws
- @cr
-
(and 2 more)
Tagged with: