how to include a comma in the output of sprintf?

gpvillamil's icon

I am using sprintf to assemble some command strings, and I need to include a comma character

For example, my sprintf looks like this:

sprintf symout send z%i min

and I want the output to look like

send z1, min

It looks like I can't include the standard ASCII escaping, eg 54 for comma.

How can I do this?

Tim Lloyd's icon

[ sprintf symout send z%i, min ]

or

[ sprintf symout send z%ld, min ]

Luke Hall's icon

You can use a backslash to escape a reserved character in objects like [sprintf] and [expr]. Try without the "symout" argument otherwise it will all be one message and won't work if you try to send it to [forward].

[sprintf send z%i, min]

lh

gpvillamil's icon

If I don't include symout then forward kicks back "forward: first extra argument must be a symbol".

If I do include symout, then the forward doesn't seem to take effect.

What seems to work is (t b i) to fire off the (sprintf send z%i) and then (min).

Is there a simpler way to do this? I just want to selectively send messages to a number of consecutively named (receive) objects.

Jesse's icon

[t min i] ?