Re: Data Conversion
- To: mathgroup at smc.vnet.net
- Subject: [mg38075] Re: Data Conversion
- From: bghiggins at ucdavis.edu (Brian Higgins)
- Date: Thu, 28 Nov 2002 14:10:10 -0500 (EST)
- References: <arsilf$eed$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
John, Here is another way:
Part1:
MapAt[StringInsert[#, "," , {4,7} ]&, Map[StringReplace[#, {"-" ->" ,
" ," "->","}]&, data1], 3]
{123,456,7899,John,Smith,222,333,4444}
Part2:
StringJoin[PadRight[ToLowerCase[Characters[StringReplace[
StringJoin[Apply[Sequence, Drop[data1, -1]]], {" " -> "", "-" ->
""}]]], 24, "0"]]
Cheers,
Brian
Moranresearch at aol.com wrote in message news:<arsilf$eed$1 at smc.vnet.net>...
> 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