samedi 18 février 2017

replace multiple same character in string with singe character in ruby

I have a dynamically generated string which can have any number of ":" in-between them example.

example1: "test string:: this is test string"
example2: "test string:::: this is test string"

I want to convert such string into following

result string1: "test string: this is test string"
result string2: "test string: this is test string"

Please help

Aucun commentaire:

Enregistrer un commentaire