Welcome to %s forums

BrainModular Users Forum

Login Register

number display and format

I need help on a Patch
Post Reply
User avatar
rlgsbt
Member
Posts: 187
Location: Marseille
Contact:

Unread post by rlgsbt » 22 Dec 2015, 09:37

Hi,
How can I turn "3" into "03". It's for a clock or a counter.
thanks
SB

by the way, is it possible to get the rests after a modulo ?

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 22 Dec 2015, 17:35

you can use concat string module and add your string to the first beeing 0;

not sure if well understood but can substract modulo result to original value to get the rest maybe?

User avatar
rlgsbt
Member
Posts: 187
Location: Marseille
Contact:

Unread post by rlgsbt » 23 Dec 2015, 09:11

Thanks 23fx23,
Substract modulo result from original value is good ! but for concat string, I want to have 2 digits (from 01 to 59) even if the input is 1, 2, 3 ( I want to turn it in 01, 02, 03... 10, 11...).

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 23 Dec 2015, 19:29

one of the possible solutions is to add & concat the 0 string, ie take your 1,2,3 ect value, convert to string using 'int to string', this feed input 2 of concat string module. on first input of concat string module type the 0. this will add a 0 before all incoming numbers, so will get a result like 01,02,03... then 010, 011 ect.
then if want only displaying 10 instead of 010, can use an extract sub-array to keep only 2 last digits. (as text is array)
ie on the module set the length to 2 and the start pos is connected to a if a>9. so you would get back 01,02,... 10,11

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests