[PD] split number into digits

Jeppi Jeppi jeppiot at hotmail.com
Sun Jan 17 19:25:01 CET 2021


Wow brilliant, super elegant. many thanks!
josep m
________________________________
From: Antoine Rousseau <antoine at metalu.net>
Sent: Sunday, January 17, 2021 7:15 PM
To: Jeppi Jeppi <jeppiot at hotmail.com>
Cc: pd-list at lists.iem.at <pd-list at lists.iem.at>
Subject: Re: [PD] split number into digits

You can do this:
- transform "float 512" into "symbol 512" using [makefilename %d]
- then transform "symbol 512" into "list 53 49 50" with [list fromsymbol].
- finally subtract 48 (which is the ascii for "0") from every item, you get "5 1 2"


Le dim. 17 janv. 2021 à 18:23, Jeppi Jeppi <jeppiot at hotmail.com<mailto:jeppiot at hotmail.com>> a écrit :
Hi there,
which would be your most elegant way to split a number into a list of digits? that is, I have the number 512 and I want the list 5 1 2
_______________________________________________
Pd-list at lists.iem.at<mailto:Pd-list at lists.iem.at> mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20210117/2f593499/attachment.html>


More information about the Pd-list mailing list