Forums > MaxMSP

how to remove quotes from a number starting with 0


sbx
March 15, 2013 | 3:01 pm

hello friends, it occurred to me that while using "sprintf" or "fromsymbol" in order to remove quotes from a number starting with 0 – for example – "0123", the output is "123". my question is first of all, why? and second – does anyone knows how to output a number that starts with 0?
thanks!

Attachments:
  1. blah.maxpat

March 15, 2013 | 3:25 pm

You can’t output a _number_ which starts with 0, only a symbol. And that’s what you already had — the quotes indicate that it’s a symbol, rather than a number. So you don’t have to do anything. The quotes will disappear when you use it for something:

– Pasted Max Patch, click to expand. –

Best, Jeremy



sbx
March 15, 2013 | 4:00 pm

hi Jeremy, thanks for responding, altho i think understand it now, it is still not solving my problem, maybe i should detail: in m4l. i want to be able to send a random device id (the id that is generated when using "—" as an argument) to another m4l device – and then make a 4 digit number out of it adding for example "1" in the end. the way im doing it now is sending it to a "sprintf %s1" problem is that i get the symbol with quotes (i.e "030") so it does not work. could be that im looking into a very simple issue, and cant see the very obvious solution right now cause im chasing my own tail :)


March 15, 2013 | 4:05 pm

Voilà!

– Pasted Max Patch, click to expand. –

Best, Jeremy



sbx
March 15, 2013 | 4:57 pm

great, thanks!



Lee
March 15, 2013 | 5:00 pm

symout….nice….


Viewing 6 posts - 1 through 6 (of 6 total)