Jump to content
Sign in to follow this  
astrax

check the string from input and remove the space character

Recommended Posts

astrax

Hi,

Please help me write a short script that checks for space character and remove it.

Thank you for assisting.

Edited by astrax

Share this post


Link to post
Share on other sites
Yashied

Share this post


Link to post
Share on other sites
astrax

StringStripWS($String, 8)

I'm not sure how i'd apply this. I have a text box ($input) asking for user input, the click of a button ($submit) will check the string for space and remove it.

Would it be correct if i write it like this?

case $submit
      StringStripWS($input, 8)
      sub()

Share this post


Link to post
Share on other sites
astrax

I found a way to do it.. thanks for the code.

Case $Submit
$RmSp = StringStripWS(GUICtrlRead($input), 8)
sub()

Share this post


Link to post
Share on other sites
z0mgItsJohn

You could also use "StringRepalce ()" here's a little example

Source :

$Replace_Space_With = '{Space}'; This can be anything.
$Input = InputBox ('Name?','Please input your name.')
$Input = StringReplace ($Input, ' ', $Replace_Space_With); Scans $Input for spaces and replaces it with $Replace_Space_With
MsgBox ('0','StringReplace () Example','Before : ' & StringReplace ($Input, $Replace_Space_With, ' ') & @CRLF & 'After : ' & $Input, '0')

Hope this helps! :)

- John


Latest Projects :- New & Improved TCP Chat

Share this post


Link to post
Share on other sites
CodyBarrett

or.. stringsplit($String, ' ') there are a few ways to do this.. i would do John's idea myself though

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.