Re: Simple String question
- To: mathgroup at smc.vnet.net
- Subject: [mg110753] Re: Simple String question
- From: "Christoph Lhotka" <lhotka at axp.mat.uniroma2.it>
- Date: Mon, 5 Jul 2010 06:00:45 -0400 (EDT)
hello, your code has the drawback to remove the 0, e.g. it will give "545 350" -> "35 455" I took care of that in my code, if you are interested... sortfoo = (StringJoin @@ # & /@ (Sort /@ IntegerDigits /@ ToExpression /@ StringSplit[#, " "] /. n_Integer :> ToString[n]) // Sort) /. {x_String, y_String} :> x <> " " <> y &; best regards, christoph On 03/07/2010 14:18, Dimitris Emmanoulopoulos wrote: > orderingstring[x_] := > StringReplace[ > StringTake[ > ToString[ > Sort[Map[FromDigits, > ToExpression[ > Map[Sort, > StringCases[StringSplit[x], DigitCharacter]]]]]], {2, -2}], > "," -> ""]