Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
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.

0 Kudos
2 REPLIES 2
RokuNB
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
0 Kudos
chaklasiyanikun
Roku Guru

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