Jump to content

Recommended Posts

Posted

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.

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
  • Developers
Posted

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
×
×
  • Create New...