Jump to content

How many spaces in $text


_Kurt
 Share

Recommended Posts

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..

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...