• Resolved lowercas3

    (@lowercas3)


    Hello is there some sample code on how to convert an integer number to its binary equivalent?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @lowercas3

    Thank you very much for using our plugin. The process is very simple. You can use the following piece of code:

    (number >>> 0).toString(2);

    For example (2 >>> 0).toString(2); is equal to 10

    Assuming you have the number field fieldname1, you can insert a calculated field in the form and enter the following piece of code as its content:

    (fieldname1 >>> 0).toString(2);

    Best regards.

    Thread Starter lowercas3

    (@lowercas3)

    Thank you very much. What about the reverse calculation – i.e. from binary to a number?

    Plugin Author codepeople

    (@codepeople)

    Hello @lowercas3

    In this case, you must use the parseInt javascript function by passing the number 2 as the second parameter parseInt(number, 2)

    Ex. parseInt(101,2) is equal to 5.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Binary’ is closed to new replies.