MathGroup Archive 2002

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

Search the Archive

Re: Data Conversion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38042] Re: Data Conversion
  • From: Marc Heusser <marc.heusser at CHEERSheusser.comMERCIALSPAMMERS.invalid>
  • Date: Tue, 26 Nov 2002 00:50:46 -0500 (EST)
  • Organization: Heusser & Heusser Ltd
  • References: <arsilf$eed$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <arsilf$eed$1 at smc.vnet.net>, Moranresearch at aol.com wrote:

> I have the following data of the following form.
> 
> {123-456-7899, John Smith,2223334444}
> 
> How can I convert this to 
> {123,456,7899, John,Smith,222,333,4444}
> and then to
> 
> {1234567899johnsmith00000)
> 
> 1. The "-" are removed
> 2. John Smith is concerted to lower case
> 3. The space between John and Smith is removed (ie john and smith is 
> concatenated)
> 4. 123454567899johnsmith is padded right so the the total  number of 
> characters is 24.
> Thank you.
> John
> 

Did you have a look at "operations on strings" in the book (chapter 
2.7.2 in version 4)?
StringJoin, StringTake, StringReplace should get you going.

eg (should do most of the work):
StringReplace["abcdabcdaabcabcd", {"abc" -> "Y", "d" -> "XXX"}]
YXXXYXXXaYYXXX


Hope that helps.

Marc

-- 
Marc Heusser
remove the obvious CHEERS and MERCIAL... from the reply address
to reply via e-mail


  • Prev by Date: RE: rightTree[tree[_, _, right_]] := right Hu?
  • Next by Date: Re: rightTree[tree[_, _, right_]] := right Hu?
  • Previous by thread: Re: Data Conversion
  • Next by thread: Re: Data Conversion