Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mitchdroid
Level 7

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.

0 Kudos
2 Replies
RokuNB
Roku Employee
Roku Employee

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
0 Kudos
chaklasiyanikun
Level 11

Re: validate if a string comes with Uppercase format

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

You should create a Function as per @RokuNB 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.

0 Kudos