BitMaskToIndex

BitMaskToString(string) takes a string and returns NF and an IndexList. NF is equal to the number of '0' and '1' characters in the string. IndexList is a table containing the positions of the '1's only counting '1's and '0's.

See also IndexToBitMask

Input

  • string : A string

Output

  • NF : Integer
  • IndexList : Table of Integers

Example

Input

Example.Quanty
BitMask = "00000 10101 000"
NF, Index = BitMaskToIndex(BitMask)
print(NF)
print(Index)

Result

12
{5,7,9}

Table of contents

Print/export