Jump to content
Sign in to follow this  
masvil

if string contains space

Recommended Posts

masvil

How can I check if a string contain a space (pure space, char 32)?

I tested StringInStr, but I can't indicate space char.

Also I tested StringIsAlNum, but it detects no-space chars too.

Share this post


Link to post
Share on other sites
MHz

Have you tried StringIsSpace?

Share this post


Link to post
Share on other sites
killaz219

What do you mean? stringinstr works

$string = "this is a string"
$strinstr = StringInStr($string, " ")
If $strinstr > 0 Then
   MsgBox( 0, "", "The " & $strinstr & "th character is a space")
Else
   MsgBox( 0, "", "no spaces found")
EndIf
Edited by killaz219

Share this post


Link to post
Share on other sites
Jos

Have a look at this and see if that makes sense: :idiot:

$istr = " "
If StringInStr($istr," ") then
   MsgBox(4096,'' , '$istr contains a space somewhere.')
EndIf 
If $istr = " " then
   MsgBox(4096,'' , '$istr contains ONE space.')
EndIf

$istr = "x x"
If StringInStr($istr," ") then
   MsgBox(4096,'' , '$istr contains a space somewhere.')
EndIf 
If $istr = " " then
   MsgBox(4096,'' , '$istr contains ONE space.')
EndIf

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
masvil

What do you mean? stringinstr works

You're right, maybe I was dronken :idiot:

Thanx

Share this post


Link to post
Share on other sites
masvil

Dronken is Dutch for Drunk.

In fact I've been a dutch lover :idiot:

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  

×