Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mitchdroid
Newbie

validate if a string comes with Uppercase format

Hi team,

I would like if there is a function to validate if a String comes in UpperCase format?

something like.. i.e ..
if m.isUppercase(value)

      //DO SOMENTHING

end if

Thanks in advance.

Tags (1)
0 Kudos
2 REPLIES 2
NB_
Roku Guru

Re: validate if a string comes with Uppercase format

you can use a regex, something like

function isUppercase(s as String)
    return not createObject("roRegEx", "[a-z]", "").isMatch(s)
end function
Tags (1)
0 Kudos
chaklasiyanikun
Roku Guru

Re: validate if a string comes with Uppercase format

@NB_ answer is correct. Please refer to the roRegex documentation for validating any type of string.

You should create a Function as per @NB_ told and pass a string in function using if condition.

function isUppercase(s as String)
    return CreateObject("roRegex", "[A-Z]", "").isMatch(s)
end function
if isUppercase(s) then
    ?"UpperCase String"
else
    ?"Not UpperCase String"
end if

You can do the same for else.

Tags (1)
0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!