John Cremona on Wed, 15 Aug 2018 16:51:35 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

printf without spaces


I would like formatted printing of a list (of positive integers) with no embedded spaces.  The %s conversion inserts spaces:

? v = vector(10,j,j)
%80 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
? printf("%s", v)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(there's a space after each comma).  Is that possible with some more % magic?  I could not see how to.

I will be outputting to a file using fprintf and am capable of applying 's/, /,/g' to that but it would be more convenient not to have to.

Second question: in the first line above is there an easier way to get a range of consecutive integers into a list?

John