Sign in to follow this  
Followers 0
Clay

Removing Tabs

13 posts in this topic

Quickie,

If I wanted to stip a string of all White spaces including all tabs would I use StringStripWs($string, 8), StringStripWs($string, 13) or would I have to use StringStripWs($string, 21) ?

Share this post


Link to post
Share on other sites



Quickie,

If I wanted to stip a string of all White spaces including all tabs would I use StringStripWs($string, 8), StringStripWs($string, 13) or would I have to use StringStripWs($string, 21) ?

8 would handle it. It will remove all spaces including the Chr(9) through Chr(13) characters (tabs, line feeds/carriage returns).

(This is basically a paraphrasing of the Help file "Remarks" for StringStripWS())


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Quickie,

If I wanted to stip a string of all White spaces including all tabs would I use StringStripWs($string, 8), StringStripWs($string, 13) or would I have to use StringStripWs($string, 21) ?

which one did you try?

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

which one did you try?

8)

I tried 8 but it did not remove the Tabs....... I was sitting at a cafe (don't have Autoit on this machine) and just was looking through the online manual. This is why I asked rather than just trying it out myself. using StringStripWs($string, 8) for sure does not remove my Tabs, unless it is some other ghost character presenting my problem and not a Tab

Share this post


Link to post
Share on other sites

I tested this with "added" tabs

; 8 = strip all spaces (over-rides all other flags)


$text = StringStripWS("   this            is   a   line    of   text   ", 8)
MsgBox(0, "Stripped Text", $text)

and I only get letters... no white spaces

?????

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

That doesn't seem to work for me.

Posted Image

Share this post


Link to post
Share on other sites

What version of Autoit are you running?

MsgBox(0, "Autoit Ver", @AutoItVersion)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

When I have used StringStripWs($string, 8) in the past Tab or not the return has been a string with no WS. Fine.

However, now I am doing something different. I am comparing two Installation agrement files. I have a local copy of the installation Agreement which I have grabbed from a server, and what I am doing is grabbing the Agreement that is displayed in the License Agreement Window in install, then comparing the two Agreements line by line. When doing this I go get inconsistencies with spacing even after using StringStripWs($string, 8). Part of the problem is that the file which the Installtion accesses in order to populate the License Agreement is a .rtf file.... So I dont know what type of formatting is going on that I can not see, that why I want to kill all spaces and just return a string but StringStripWs($string, 8) is not helping me.

Edit: The text i rip from the Installation Window is in txt format..... and my local copy is also in txt format. I have been working on this damn thing for 3 days now...but it is winning

Edited by Clay

Share this post


Link to post
Share on other sites

What version of Autoit are you running?

MsgBox(0, "Autoit Ver", @AutoItVersion)

8)

3.2.12.1 (As you can see in my screenshot muttley )

Share this post


Link to post
Share on other sites

When I have used StringStripWs($string, 8) in the past Tab or not the return has been a string with no WS. Fine.

However, now I am doing something different.

(My bad, your version shows on your pic above)

First, we got to get the WS fixed in the two line script above to run correctly... then look at your other text

... try downloading and running with the latest beta

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

(My bad, your version shows on your pic above)

First, we got to get the WS fixed in the two line script above to run correctly... then look at your other text

... try downloading and running with the latest beta

8)

The 2 line scrip does work for me not sure about the bomber (KentonBomb)

Share this post


Link to post
Share on other sites

Edit: The text i rip from the Installation Window is in txt format..... and my local copy is also in txt format.

I would try to place the text in "Word" and display all characters

both being in .txt should compare easily to me... there could be something there..

... but I don't know either

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

The 2 line scrip does work for me not sure about the bomber (KentonBomb)

Not sure of your exact method of generating your original $string variable, but the following should at least show you the ASCII values of the "ghosted" tab characters in your string. The result is a 2-dim array, with the visible character in the first column, and the ASCII value in the second.

Hope it's of some help:

#include <Array.au3>
Dim $aChars[1][2] = [["0",""]]
$string = "Super cali fra gi list ic ex pi ali do cious"

$sResult = StringStripWS($string,8)
$aTmp = StringSplit($sResult,"")

ReDim $aChars[UBound($aTmp)][2]
$aChars[0][0] = $aTmp[0]
For $i = 1 To $aTmp[0]
    $aChars[$i][0] = $aTmp[$i]
    $aChars[$i][1] = Asc($aTmp[$i])
Next

_ArrayDisplay($aChars)
MsgBox(64,"Test",$sResult)

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0