Ruby Array parsing (REGEX) -
i have array in ruby has values below:
arr value 1 : tb-5-atf, ac-23 value 2 : tb-5-atf, ac-5498 value 3 : tb-5-atf, ac-236
i want extract numbers after last '-' i.e. 23, 5498, 236 out of this.
i think simple should have googled bit ruby strings. need
arr[i].split("-").last.to_i
i tried on irb
1.9.3p194 :003 > "tb-5-atf, ac-23".split("-").last.to_i => 23
Comments
Post a Comment