From: Priyank Shah on 30 Jul 2010 09:17 Hi, I have two strings, like @a = "hello" @b = "h123llo" so in that how can i print diffrence? i want difference like user know which diffrence on which character. Please let me know if any one know. Thanks in advance Priyank -- Posted via http://www.ruby-forum.com/.
From: Peter Hickman on 30 Jul 2010 09:33 One method, and I stress this is only one method, is the Levenshtein distance at http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Levenshtein_distance#Ruby and it has code, in ruby!
From: Josh Cheek on 30 Jul 2010 14:43 [Note: parts of this message were removed to make it a legal post.] On Fri, Jul 30, 2010 at 8:17 AM, Priyank Shah <shahpriyank01(a)gmail.com>wrote: > Hi, > > I have two strings, like > @a = "hello" > @b = "h123llo" > > so in that how can i print diffrence? > > i want difference like user know which diffrence on which character. > > Please let me know if any one know. > > Thanks in advance > Priyank > -- > Posted via http://www.ruby-forum.com/. > > "Difference" in this case does not seem very well defined.
From: Intransition on 30 Jul 2010 15:29 On Jul 30, 9:17 am, Priyank Shah <shahpriyan...(a)gmail.com> wrote: > Hi, > > I have two strings, like > @a = "hello" > @b = "h123llo" > > so in that how can i print diffrence? > > i want difference like user know which diffrence on which character. There is strmask (http://rubyworks.github.com/strmask/) Also the Levenshtein distance is String#edit_distance in Ruby Facets.
From: Gavin Sinclair on 30 Jul 2010 18:35
> > i want difference like user know which diffrence on which character. > There's a "differ" gem which could be useful for you. Gavin |