Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13898 > unrolled thread

Re: Swap lowercase and uppercase letters

Started byAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
First post2013-03-20 08:22 +0000
Last post2013-03-20 08:22 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Swap lowercase and uppercase letters Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2013-03-20 08:22 +0000

#13898 — Re: Swap lowercase and uppercase letters

FromAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
Date2013-03-20 08:22 +0000
SubjectRe: Swap lowercase and uppercase letters
Message-ID<kibrk8$14s$1@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@iee.lu



[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web