MathGroup Archive 2010

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

Search the Archive

Re: Simple String question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110695] Re: Simple String question
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Fri, 2 Jul 2010 07:26:43 -0400 (EDT)

Hi Steve,

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

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

Out[1]= "157 236"

Regards,
Leonid


On Thu, Jul 1, 2010 at 11:54 PM, S. B. Gray <stevebg at roadrunner.com> 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