MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simple String question

Hi Steve,

I don't know how to do that purely with strings, but it is not hard to do by
splitting to characters:

StringJoin[#1, " ", #2] & @@
 StringJoin @@@
  Sort[Sort[Characters[#]] & /@ StringSplit["623 715", " "]]

Out[1]= "157 236"


On Thu, Jul 1, 2010 at 11:54 PM, S. B. Gray <stevebg at> wrote:

> I have strings like foo="623 715". foo will always be 3 digits, space, 3
> digits. I need to put each set of digits in numerical order and then put
> the two triples in order. This would give 157 236. There must be a
> simple way to do this, but I see nothing under string sorting.
> Steve Gray

  • Prev by Date: How to edit a help reference page (e.g. NIntegrate.nb)?
  • Next by Date: Re: Simple String question
  • Previous by thread: Simple String question
  • Next by thread: Re: Simple String question