Cheetah Template --see if a variable contains a certain string value

66 views
Skip to first unread message

storm...@gmail.com

unread,
Sep 13, 2021, 8:33:59 PM9/13/21
to weewx-user
Wondering if there is a way using Cheetah to check for a string value in a variable.

gjr80

unread,
Sep 13, 2021, 8:41:44 PM9/13/21
to weewx-user
Simple, just some in-line python code. Something like (untested):

#if 'some_string' in $my_string
    ## 'some_string' is in $my_string, do something
    #pass
#else
    ## 'some_string' is not in $my_string, do something else
    #pass
#end if

Gary

storm...@gmail.com

unread,
Sep 13, 2021, 8:46:01 PM9/13/21
to weewx-user
Thanks Gary for quick response.  I will give that a try.

storm...@gmail.com

unread,
Sep 27, 2021, 12:15:33 AM9/27/21
to weewx-user
Sorry Gary been a little busy here.  Yes it does work.
Reply all
Reply to author
Forward
0 new messages