Sign in to follow this  
Followers 0
d0n

Counting string

6 posts in this topic

what command should i look at if i want to count the number of upper case letter within a string?

Share this post


Link to post
Share on other sites



Hi,

Global $test = "Hello WOrld"

MsgBox(0,"",_getCountUpperChars($test))

Func _getCountUpperChars($string)
    Local $count = StringRegExp($string, '[A-Z]', 3)
    If @error Then Return 0
    Return UBound($count)
EndFunc  ;==>_getCountUpperChars

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

wow that was quick, thanks

Share this post


Link to post
Share on other sites

Another approach...

Local $Count = 0

$String = "This is a Test for Autoit String Results" 

$Split = StringSplit($String, "")

For $x = 1 To $Split[0]
    If StringIsUpper($Split[$x]) Then $Count += 1
Next

MsgBox(0x0, "Counter", "String uppercase count is: " & $Count & "   ")

Although, StringRegExpress is a better way ( many here dont know how to use it!!!... :)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

wow that was quick, thanks

Welcome! Never needed something like that before :)


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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