Extract a specific number from a binary string

Hi,

I’m creating an app similar to an alarm clock.
To setup the days on wich the alarm will ring, I’m using a binary string with 7 characters like this : 0000011 (in this example the alarm will be executed on saturday and sunday only). This configuration is saved in database.

Now my problem : I have 7 checkbox (one for each week days), initially, I need them to be dynamically checked or not depending of this binary string.
To achieve this, I need to extract these numbers one by one and identify if they are 1 or 0.

For example, to check or not Wednesday Checkbox, I need to extract the 3rd character in the string and identify if it’s 1 or 0.
Do you know how to proceed ? I tried using “truncate” or “contains” without succeeding.
Their is no way to use “truncate” + “start_with” apparently.

image

Thank your for your help!!

up someone ?

It’s not the cleanest solution but you should be able to combine truncate and truncate from end to get what you need. So for Wed, I think you could set a condition on the checkbox to test for value of your string truncated to 3:truncated from end to 1 and if this value is 1, set the checkbox to checked. I hope this makes sense.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.