Sign in to follow this  
Followers 0
masvil

if string contains space

7 posts in this topic

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

Have you tried StringIsSpace?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                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

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

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