| View previous topic :: View next topic |
| Author |
Message |
Eedis
Joined: 12 Jun 2009 Posts: 397
|
Posted: Sat Oct 17, 2009 7:22 am Post subject: Can you count how many chars are in a var? |
|
|
I want to count how many characters there are in a variable, then store that number as it's own variable...
Is this possible?
What I was wanting to do, a rough idea to maybe help you understand. I'm 'StringSplit'ing a long sentence, to get each seperate word. Then I want a loop to run, the amount of words there are in that sentence... Is that possible? _________________ Pylons Are Trapped Balls.
http://www.autohotkey.net/~Eedis/
 |
|
| Back to top |
|
 |
jethrow
Joined: 24 May 2009 Posts: 783 Location: Iowa, USA
|
|
| Back to top |
|
 |
Eedis
Joined: 12 Jun 2009 Posts: 397
|
Posted: Sat Oct 17, 2009 7:28 am Post subject: |
|
|
I want to find how many words there are, not all characters. _________________ Pylons Are Trapped Balls.
http://www.autohotkey.net/~Eedis/
 |
|
| Back to top |
|
 |
jethrow
Joined: 24 May 2009 Posts: 783 Location: Iowa, USA
|
Posted: Sat Oct 17, 2009 7:31 am Post subject: |
|
|
| Code: | string := "I want to find how many words there are, not all characters."
StringReplace, string, string, %A_Space%, %A_Space%, UseErrorLevel
var := ErrorLevel+1 |
Or, better yet: | Code: | | RegExReplace(string, "\S+", "", var) |
_________________ AHKL, COM_L,Webpage Controls,Donate to AHK |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7179
|
Posted: Sat Oct 17, 2009 8:02 am Post subject: |
|
|
|
|
| Back to top |
|
 |
flak
Joined: 02 Oct 2009 Posts: 69
|
Posted: Sat Oct 17, 2009 8:06 am Post subject: |
|
|
| Code: |
StringSplit, OutputArray, InputVar
MsgBox % OutputArray0
|
|
|
| Back to top |
|
 |
Z_Gecko Guest
|
|
| Back to top |
|
 |
|