Sign in to follow this  
Followers 0

check the string from input and remove the space character

6 posts in this topic

Posted (edited)

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



Posted

Hi,

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

Thank you for assisting.

StringStripWS($String, 8)

Share this post


Link to post
Share on other sites

Posted

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

Posted

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

Posted

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

Share this post


Link to post
Share on other sites

Posted

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  
Followers 0