Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- conv01 = Map["["<>StringJoin@@Riffle[#,","]<>"]"&,Map[ToString,#,{2}],{0,1}]&
- list = {{1, 2, "test3"}, {3, 4, "test4"}}
- "[[1, 2, "test3"], [3, 4, "test4"]]"
- conv03 = Map["[" <> ToString@Row[#, ","] <> "]" &, list, {0, 1}]
- "[" <> ToString@Row[{1, 2, 3, 4}, ","] <> "]"
- ExportString[{
- {1, 2, "Three"},
- {4, 5, "{Six}"}
- }, "JSON"]
- list = {{1, 2, "test3"}, {3, 4, "test4"}};
- StringReplace[ToString@FullForm@list, "List[" -> "["]
- "[[1, 2, "test3"], [3, 4, "test4"]]"
- bracketFormat[expr_] :=
- StringReplace[
- ToString[expr, InputForm],
- {s : Shortest[""" ~~ __ ~~ """] :> s, "{" -> "[", "}" -> "]"}
- ]
- list = {{1, 2, "test3"}, {3, 4, "test4", "trick{}"}};
- bracketFormat[list]
- "[[1, 2, "test3"], [3, 4, "test4", "trick{}"]]"
- [[1, 2, "test3"], [3, 4, "test4", "trick{}"]]
- With[{s = StringJoin@RandomChoice[CharacterRange["a", "z"], 30]},
- StringReplace[ToString[list /. {x_String :> """ ~~ x ~~ """, List -> s}], s -> ""]
- ]
- (* [[1, 2, "test3"], [3, 4, "test4"]] *)
- list={{1,2,"123"},{1,2,"123"}};
- Module[{$replace$},
- StringReplace[ToString@FullForm@Map[ $replace$@@#&,list,{0,1}],ToString@$replace$->""]
- ]
- ToExpression@"{{2,3,"List[thiswouldbreaksomeothermethods] test{123}"},{3,5,"more [stuff]"}}" /. List :> ("[" <> StringJoin[ToString /@ {##}~Riffle~","] <> "]" &)
- {{2,3,"List[thiswouldbreaksomeothermethods] test{123}"},{3,5,"more [stuff]"}} /. List :> ("[" <> StringJoin[ToString /@ {##}~Riffle~","] <> "]" &)
- "[[2,3,List[thiswouldbreaksomeothermethods] test{123}],[3,5,more [stuff]]]"
- ListFormat -> {"[", ",", "]"}
- quoted /: TextString[quoted[str_]] := """ <> str <> """;
- quoted /: TextString[quoted[str_String]] := """ <> str <> """;
- quoted /: TextString[quoted[str_]] := TextString@str;
- TextString[MapAll[quoted, list], ListFormat -> {"[", ",", "]"}]
- (* "[[1,2,"test3"],[3,4,"test4"]]" *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement