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

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.