From: j3n7il jones Date: 2006-07-06T02:34:19+09:00 Subject: Find Position of text Im trying to recreate a function I had in Delphi for ruby, but cannot figure out how to search for a string withn a string Here is the Delphi code function ReplaceString(str, value, replacer: String): String; var aPos: Integer; rslt: String; begin aPos := Pos(value, str); rslt := ''; result := str;//in case there is nothing to replace, return orig string while (aPos <> 0) do begin rslt := Copy(str, 1, aPos - 1) + replacer; rslt := rslt + Copy(str, aPos + Length(value), Length(str)); str := rslt; aPos := Pos(value, str); result := rslt; end; end; As you can see after begin, it calls a pascal function called "pos" which just looks for value(a string) within str (another string) and returns a number, the position of value within str. Possible in ruby? -- Posted via http://www.ruby-forum.com/.