From: huseyin polat Date: 2006-03-03T09:18:04+09:00 Subject: Re: gsub problem bluemonk wrote: > huseyin polat wrote: > >> now I want to print this string as >> [1,2],[2,1],[3,1],[4,1] >> in other word I want to add comma between those ][ and make them look >> like ],[ >> I tried gsub with hundred different possibilities but no luck, > > no need of regexps nor gsub: > > str.split("][").join("],[") #=> "[1,2],[2,1],[3,1],[4,1]" > > Ciao! > Marco > > -- > This way, to star trek... thank for post, but didn't change anything. maybe I should post my entire program. anybody wants to post their email to take a look at the program ? one more thing, I get the string from a value [1,2][2,1][3,1][4,1] that is originally created by push an array and then copied into my hash bighash.sort.each{|key,value| value.each{ |value| str=String.new value=value.to_s str=value print str.split("][").join("],[") } -- Posted via http://www.ruby-forum.com/.