Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

check the string from input and remove the space character


  • Please log in to reply
5 replies to this topic

#1 astrax

astrax

    Seeker

  • Active Members
  • 25 posts

Posted 13 May 2009 - 12:16 AM

Hi,

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

Thank you for assisting.

Edited by astrax, 13 May 2009 - 12:18 AM.








#2 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,574 posts

Posted 13 May 2009 - 12:20 AM

Hi,

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

Thank you for assisting.

StringStripWS($String, 8)

#3 astrax

astrax

    Seeker

  • Active Members
  • 25 posts

Posted 13 May 2009 - 12:33 AM

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()


#4 astrax

astrax

    Seeker

  • Active Members
  • 25 posts

Posted 13 May 2009 - 01:32 AM

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

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


#5 z0mgItsJohn

z0mgItsJohn

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 288 posts

Posted 13 May 2009 - 01:36 AM

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

#6 CodyBarrett

CodyBarrett

    I LOVE Juicy Fruit!!!

  • Active Members
  • PipPipPipPipPipPip
  • 1,225 posts

Posted 13 May 2009 - 01:38 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users