473,785 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

compare two string and get the difference

Hi there,
I am trying to compare two strings and get the differenc
in vbscript.

Example: Str1="This is a test text"
Str2="This is a fine test text but a little long"
I like to compare str1 with str2 and get the difference.
Above example the difference will be "fine" and "but a
little long"
How do I do that? A sample code would be apprciable.

Thanks for your time

Jyoti
Jul 19 '05 #1
3 5805
actually that isnt' the "difference ". Technically you'd have to do a
position by position check or a word by word check, splitting it on the " "
(spaces) which isn't accurate really though.

There really is no direct way to get these differences directly. Could you
explain a little more on the idea you are trying to get to?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"jyoti" <mu************ *@hotmail.com> wrote in message
news:18******** *************** ******@phx.gbl. ..
Hi there,
I am trying to compare two strings and get the differenc
in vbscript.

Example: Str1="This is a test text"
Str2="This is a fine test text but a little long"
I like to compare str1 with str2 and get the difference.
Above example the difference will be "fine" and "but a
little long"
How do I do that? A sample code would be apprciable.

Thanks for your time

Jyoti

Jul 19 '05 #2
Thanks for your reply..

I am developing a web site content managment system for our
organization. Anybody changes anything on the content of the web site,
goes through a review process. When somebody make any update and upload
to pre-production area, the system sends an email to reviewer to review
the update. The email contains a URL where reviewer can view the updated
page.

I have two folders. One is original folder and the other one is Update
folder.

I like to highlight the updated area when reviewer visits the url to
review.

Example:
At Original Folder:
Test.txt file contains " This is a test text"
At Update Folder:
Test.txt file contains "This is a fine text blala"
I like to highlight the word "fine" and "blala".

I can go line by line and compare both files. If lines are different
then I can highlight the whole line on Test.txt on update folder. But
the problem is if line is too long and user makes just one or two words
update, then it will highligh the un-neccessary area.

Any suggestion..

Thanks for your time.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
what I'm saying though is that

"Hello my name is Curt" campared with
"Hello There my name is Curt" doesnt' result in only showing "There" as the
difference. EVERYTHING from the word "There" on is different technically,
it's all shifted over one word.

I would say do a LINE comparison, just indicating that the LINE has changes,
but again, if anything shifts down a line EVERY line from that point on will
be "changed".
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Muhammad Rahman" <mu************ *@hotmail.com> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
Thanks for your reply..

I am developing a web site content managment system for our
organization. Anybody changes anything on the content of the web site,
goes through a review process. When somebody make any update and upload
to pre-production area, the system sends an email to reviewer to review
the update. The email contains a URL where reviewer can view the updated
page.

I have two folders. One is original folder and the other one is Update
folder.

I like to highlight the updated area when reviewer visits the url to
review.

Example:
At Original Folder:
Test.txt file contains " This is a test text"
At Update Folder:
Test.txt file contains "This is a fine text blala"
I like to highlight the word "fine" and "blala".

I can go line by line and compare both files. If lines are different
then I can highlight the whole line on Test.txt on update folder. But
the problem is if line is too long and user makes just one or two words
update, then it will highligh the un-neccessary area.

Any suggestion..

Thanks for your time.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
3482
by: Christian Seberino | last post by:
How does Ruby compare to Python?? How good is DESIGN of Ruby compared to Python? Python's design is godly. I'm wondering if Ruby's is godly too. I've heard it has solid OOP design but then I've also heard there are lots of weird ways to do some things kinda like Perl which is bad for me. Any other ideas?
8
62658
by: Sharon | last post by:
hi, I want to compare character, if the string contains character "-" then it will print Hello on the screen however, neither method (1) nor method (2) work in the code below: so what the correct code should be? thanks! #include <stdio.h> #include <stdlib.h> int main()
19
9521
by: David zhu | last post by:
I've got different result when comparing two strings using "==" and string.Compare(). The two strings seems to have same value "1202002" in the quick watch, and both have the same length 7 which I have tried to print out by debug.writeline(). But the "==" operator results false, and string.Compare() results true. Somebody helps me!
4
28036
by: Sasidhar Parvatham | last post by:
Hi All, How do I compare two strings and get all the positions where there is a difference between them? Thanks, Sasidhar
3
4946
by: dotnetnoob | last post by:
i have two strings from xml file str1 = 800.7415_801.101_8.115_216.12 str2 = 800.7415_801.101_8.115_216.12_217.570 the first stream represent a xml file 800.7415_801.101_8.115_261.12.xml which hold some value that can only be look up after i compare both string so i can find where to look up the value of object type 217 and the instance number 570
11
17817
by: balakrishnan.dinesh | last post by:
hi frnds, Im having two 20digit numbers, But while comparing those it is giiving wrong ouput in javascript. for example here is my code, my secanrio is , ~ If first 20 digit number is greater number than second 20 digit number ,then it should return.
4
6663
by: Lamis | last post by:
Hi, what is the best way to compare 2 haschtables contatining objects. the objects has 2 property, name & value. I need to print out the differences -- LZ
3
5410
by: artev | last post by:
in the default sort which is the compare function used? alphabetical ordination is so:arry.sort(); but which is the default function used? is there a good link wich example for alphabetical order and also for multiarray order? (previous post)
6
2638
by: Muhs | last post by:
Hi !! i want to compare two strings and return the difference For example, i have two strings, string str1="then"; string str2="than"; it compared the two strings and returns 1, as only one character is different (a and e). Is there a function in c# that can do this??
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.