cleaning data (array related)
Posted: Fri Nov 08, 2013 10:34 pm
I can't find it, so I'm not sure whether I posted this question earlier, or just started to write the post, and closed the browser in the middle. Mixed memories about arrays confuse me even more.
I guess this is again ruby question. Cleaning data from non-numeric characters, spaces and so on. While it's not a big deal with anything after numers (standard green prims can do this by default), I don't know how to remove anything prior do that data.
Let say that I have an array written like this:
11asd,12bcv3,crd13, 14,15
A real mess, but it should end like this:
11,12,13,14,15
So all non-numeric characters (except comma - yep, this time comma) prior to first numeric substring (at index), and after it - are removed.
The cleaning has to do with possible user interactions with data, that are entered manually. I used harsh example; usually it will be all sort of typos.
I guess this is again ruby question. Cleaning data from non-numeric characters, spaces and so on. While it's not a big deal with anything after numers (standard green prims can do this by default), I don't know how to remove anything prior do that data.
Let say that I have an array written like this:
11asd,12bcv3,crd13, 14,15
A real mess, but it should end like this:
11,12,13,14,15
So all non-numeric characters (except comma - yep, this time comma) prior to first numeric substring (at index), and after it - are removed.
The cleaning has to do with possible user interactions with data, that are entered manually. I used harsh example; usually it will be all sort of typos.