Skip to content

A way to tell numbers from 0x/0b apart? #172

@Reptorian1125

Description

@Reptorian1125

Looking at the documentation, there is isnum() and isint(), and they both see 0xdb as true. Of course it is. But, how to tell 0xdb apart from 219 as a one-liner? What I'd like is to treat 0,2,5,6.5 as 1 while 0b/0x(num) as 0. Maybe decimals isn't needed here too.

EDIT:

This work. Had to put in escapes, and it took me a while to get there.

root@localhost:~# gmic eval same\(isint\(\'0123456789\'\,_\'0\',_\'9\'\),1\) ps
[gmic]./ Start G'MIC interpreter (v.3.5.5).
[gmic]./ Evaluate expression 'same(isint('0123456789',_'0',_'9'),1)' and assign it to status.
1
[gmic]./ End G'MIC interpreter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions