Re: compressed list output
- To: mathgroup at smc.vnet.net
- Subject: [mg19716] Re: [mg19671] compressed list output
- From: BobHanlon at aol.com
- Date: Mon, 13 Sep 1999 02:40:52 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Rita,
trimList[x_List] := StringReplace[
ToString[x], {", 0." -> ",.", ", " -> ",", "{0." -> "{."}]
test = {0.1, 0.35, 0.6, 1.4, 2.62291, 6, 20};
test // trimList
"{.1,.35,.6,1.4,2.62291,6,20}"
(% // ToExpression) == test
True
Bob Hanlon
In a message dated 9/9/1999 6:14:06 AM, R.Bijlsma at iri.tudelft.nl writes:
>I want to output a list as short as possible, but including
> all information:
>
> {0.1, 0.35, 0.6, 1.4, 2.62291, 6, 20}
>
> Should preferably by written as:
>
> {.1,.35,.6,1.4,2.62291,6,20}
>
> Can someone tell me how to do this? Changing the separator
> from ", " to "," would already help a lot!
>