regex - scala replace string with underscore joined -


i have general question how replacing string parts.

say have 2 strings:

a = "i going watch game of throne tonight on throne" b = "game_of_throne" 

what efficient way replace game of throne game_of_throne (i.e adding under score treat 1 string subject). if regex:

val c = """_""".r.replaceallin(b," ").r val c.replaceallin(a, c) how ask draw underscore? 

i trying avoid splitting string since increases computation time quite lot.

edit: have million pair of these, need able use map , variable , b.

a.replaceall(b.replaceall("_", " "), b)

not sure if there more pure scala way should do.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -