Add spaces to each element of a massage

Wil's icon

Sorry about this very simple operation I guess I don't know.

How do I add space to dynamically changing message?

[11] = [1 1]

[111] = [1 1 1]

etc.

Max Patch
Copy patch and select New From Clipboard in Max.
Roman Thilenius's icon

that´s not yet the elegant patch you are looking for, but ... dirty version:

- convert symbol to list of characters
- iterate list
- concatenate characters with space characters
- rejoin




Wil's icon

don't need elegant - functional is great!

11OLSEN's icon
2 examples using [regexp]
Max Patch
Copy patch and select New From Clipboard in Max.

■■■■■■■■■■■■■■■

Wil's icon

cool bananas bandanas and bongos!

Max Patch
Copy patch and select New From Clipboard in Max.
Roman Thilenius's icon

how the heck did you come up with that .{1}? regexp synthax will never get me.

Source Audio's icon

.{1} is standard regex operation = match 1 char

11OLSEN's icon

Yes, very useful also to specify a range. e.g. split everything into groups of 3 but also accept 1 or 2:

@Roman I like the regexp very much. I started to collect examples for this object long ago. Now most of the times I only have to slightly modify one of the examples.

I want to add that this example (using @substitute) is only relevant if you use the first outlet.

The third outlet is a list of substrings anyway so simply matching any character with a dot is enough to get a list of chars.