samedi 18 avril 2015

Modifying White Space Elements From Element in Array of Array

I have the following array of arrays:



arr1= [["a b", "bla", "bla", "bla", "bla"], ["c d", "bla", "bla", "bla", "bla"], ["a b. c", "bla", "bla", "bla", "bla"], ["f g", "bla", "bla", "bla", "bla"], ["i", "bla", "bla", "bla", "bla"]]


In my example, I am focused on the first elements in the inner arrays. These can include items that are of the format "x", "x y" (w a blank space between two groups of characters), and "x y z" (w two blank spaces between three groups of characters.


I would like to delete the y from the third group of elements (so that "x y z" becomes "x z"). arr1 shown above is an example - the array I'm working with has a couple hundred entries. In that example above, I'd want "a b. c" to become "a c" in the third array in arr1.


Aucun commentaire:

Enregistrer un commentaire