Jump to content

Counting string


d0n
 Share

Recommended Posts

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

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

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

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