Sign in to follow this  
Followers 0
sensalim

Strip TABS from a string?

6 posts in this topic

$string = "[    test    ]"
MsgBox(0, "Original String", $string)
StringReplace($string, chr(9), "")
MsgBox(0, "Modified String", $string)

How do you do this?

Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$string = "[    test    ]"
MsgBox(0, "Original String", $string)
$string1 = StringReplace($string,"  ","")
MsgBox(0, "Modified String", $string1)

did you try like this

edited now its working XD

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

$string = "[    test    ]"
MsgBox(0, "Original String", $string)
StringReplace($string, chr(9), "")
MsgBox(0, "Modified String", $string)

How do you do this?

Thanks.

Your code is fine except for one detail. You're not replacing the value of $string when you're doing your StringReplace(). Try this:

$string = "[    test    ]"
MsgBox(0, "Original String", $string)
$string = StringReplace($string, chr(9), "")
MsgBox(0, "Modified String", $string)

- 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

D'oh!

Thank you.

Share this post


Link to post
Share on other sites

Having brain fart here, what if I only want to trim the trailing tab(s)?

Share this post


Link to post
Share on other sites

Having brain fart here, what if I only want to trim the trailing tab(s)?

Try $String = StringStripWS($String, 2)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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