# How can I transform parts of an Integer list to a String list

There is a sorted list of Integers.

ilist = PadRight[Sort[ RandomSample[Range[1, 99999], 3], Less], 5]


It should become string area codes like:

{0123, 023345, 043563, 0, 0};


with trailing zeros.
Can I do this with one function?

slist=ReplaceAll[ilist,n_Integer :>"0"<>ToString[n]]


Note: last elements are zeros already and should not double.

-
Doe ReplaceAll[ilist, n_Integer :> "0" <> ToString[n] /; n =!= 0] work for you? – Sjoerd C. de Vries Jun 17 '13 at 11:20
slist=ReplaceAll[ilist,n_Integer/;n!=0:>"0"<>ToString[n]] aha, same to Sjoerd – HyperGroups Jun 17 '13 at 11:22
these will leave 0 as an integer no?. could do ReplaceAll[ilist,n_Integer :> If[n==0,"0","0" <> ToString[n] ]] – george2079 Jun 17 '13 at 12:44
If you export it as .csv you have to import it back as file.csv,"Text". . .Then your zeros are coming in to. . I like your solutions. – Hp Radojewski Schäfer Von Jun 18 '13 at 17:35

Yet another way to do this is to PadRight with the zero string...

ilist = PadRight["0" <> ToString@ # & /@
Sort[RandomSample[Range[1, 99999], 3], Less], 5, "0"]


(* {027082, 039217, 085143, 0, 0} *)

Head /@ ilist


(* {String, String, String, String, String} *)

-