MathGroup Archive 2013

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

Search the Archive

Re: Swap lowercase and uppercase letters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130207] Re: Swap lowercase and uppercase letters
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Wed, 20 Mar 2013 04:22:18 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hi:

I have the following example:  "hELLO THERE!"

Using Mathematica 8.0.4, how can I swap the lowercase and uppercase letters to output,

"Hello there!"


Thanks,

Bill

Hi, Bill,

These two functions:

revertCharacter[x_String] :=
  If[UpperCaseQ[x], ToLowerCase[x], ToUpperCase[x]];

revertString[string_String]:=Map[revertCharacter,Characters[string]]//StringJoin;

do the job in Mathematica 9 at least:

revertString@"hELLO THERE!"
revertString@"Hello there!"

"Hello there!"

"hELLO THERE!"

I expect that it should also work in the version 8.


Have fun, Alexei


Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu






  • Prev by Date: Re: Cropping image parts through list of lists
  • Next by Date: Re: Swap lowercase and uppercase letters
  • Previous by thread: Re: Swap lowercase and uppercase letters
  • Next by thread: Re: Swap lowercase and uppercase letters