Sign in to follow this  
Followers 0
_Kurt

How many spaces in $text

4 posts in this topic

Hey, I've figured out a way to see how many spaces there are in $text, but it seems to take quite some time. I was wondering if there could be any other way.

Here is my example for my solution:

$text   = "Hello, I'm Kurt"
$1a     = StringSplit($text, " ")
If StringInStr($text, " ") Then 
    If $text = $1a[1] & " " & $1a[2] Then
        Msgbox(0,"","2 words")
    Else
        If $text = $1a[1] & " " & $1a[2] & " " & $1a[3] Then
            Msgbox(0,"","3 words")
        Else
            Msgbox(0,"","4 words, And so on..")
        EndIf
    EndIf
Else
    Msgbox(0,"","One Word")
EndIf

Any ideas?

Thanks,

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites



$text = "Hello, I'm Kurt"

$1a = StringSplit($text, " ")

Msgbox(0,"",$1a[0]-1 & " spaces")


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

Thanks for your help, guys!

:P

Kurt


Awaiting Diablo III..

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