String comparisions

T

Talib Hussain

Experts,

I have a requirement of comparing string and getting the difference out

For Example :

strOne = "Hello, this is a test"
strTwo = "Hello, this is a test forum"

This should result that word "forum" is extra.

Any thoughts?

Regards,
Talib Hussain
 
D

Dylan Evans

[Note: parts of this message were removed to make it a legal post.]

strTwo.split(strOne)[1].lstrip

But that's very specific.
 
A

Alex Katebi

[Note: parts of this message were removed to make it a legal post.]

Look into the ruby full-text search.
 
R

Robert Klemme

2009/2/12 Talib Hussain said:
I have a requirement of comparing string and getting the difference out

For Example :

strOne = "Hello, this is a test"
strTwo = "Hello, this is a test forum"

This should result that word "forum" is extra.

Any thoughts?

IMHO your question is by far not specific enough. What kind of output
do you expect exactly? Do you want all _words_ reported that are
missing or extra? Do you have to have _substrings_ reported which are
missing or extra? Do you need _positional information_ with that? If
so, which (word position, character position)? Do you need human
readable output or do you want to automatically process it? etc.

Cheers

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top