By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,312 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,312 IT Pros & Developers. It's quick & easy.

Compare Two Strings

P: n/a
HI there
i want to compare between two strings char by char.every
strings having a word document.first string name is strFileName and
second string name is strFilename1.
i want to compare strFileName with strFileName1.if there is any mistek
or some word is missing in second string then that words should be
highlight(in sense change the color of that words) by the button click
event.
pls somebody give an idea to me.

Twinkle

Aug 12 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Twinkle,

I'm not sure what you are asking for.

Do you have two almost identical strings and want to mark the differences (like comparing a document with its older version)? Or do you have mean string1 is a list of words that should occur at least once in string2, and mark missing words?

When you mean highlight missing words, what do you mean? Strings can't be highlighted, but you can add codes that will cause words to be highlighted when displayed in various ways. How to highlight a word very much depends on what you display it with.

If string1 is "Hello World." and string2 is "Hello. How are you." What do you expect to happen?

On Sat, 12 Aug 2006 12:15:56 +0200, Twinkle <he*************@gmail.comwrote:
HI there
i want to compare between two strings char by char.every
strings having a word document.first string name is strFileName and
second string name is strFilename1.
i want to compare strFileName with strFileName1.if there is any mistek
or some word is missing in second string then that words should be
highlight(in sense change the color of that words) by the button click
event.
pls somebody give an idea to me.

Twinkle



--
Happy coding!
Morten Wennevik [C# MVP]
Aug 12 '06 #2

P: n/a
HI Mortan
u got something right.i explain that
first string strFileName having a word document and second
strFileName1 having html document.in this html file some data of
word file is existing.like if strFilename have "Hello World" and
strFileName1 also have "Hello World" like this
now i have to compare these two string.if i select "Hello world" in
first string and click button then if any word of "Hello World" missing
in second string(like "Hello Word") then it will be displayed
highlight.L is missing then L should be marked in second string

That's it..plz help me if u know about it
Twinkle
Morten Wennevik wrote:
Hi Twinkle,

I'm not sure what you are asking for.

Do you have two almost identical strings and want to mark the differences (like comparing a document with its older version)? Or do you have mean string1 is a list of words that should occur at least once in string2, and mark missing words?

When you mean highlight missing words, what do you mean? Strings can't be highlighted, but you can add codes that will cause words to be highlighted when displayed in various ways. How to highlight a word very much depends on what you display it with.

If string1 is "Hello World." and string2 is "Hello. How are you." What do you expect to happen?

On Sat, 12 Aug 2006 12:15:56 +0200, Twinkle <he*************@gmail.comwrote:
HI there
i want to compare between two strings char by char.every
strings having a word document.first string name is strFileName and
second string name is strFilename1.
i want to compare strFileName with strFileName1.if there is any mistek
or some word is missing in second string then that words should be
highlight(in sense change the color of that words) by the button click
event.
pls somebody give an idea to me.

Twinkle

--
Happy coding!
Morten Wennevik [C# MVP]
Aug 12 '06 #3

P: n/a
I don't think this can be solved easily. For instance, how do you find the proper Hello World in each document.

To begin with, you need to find out how to parse the document and the html file and extract only the text. You could then do a character by character comparison and write a third string as you go with missing characters and color codes.
On Sat, 12 Aug 2006 14:59:52 +0200, Twinkle <he*************@gmail.comwrote:
HI Mortan
u got something right.i explain that
first string strFileName having a word document and second
strFileName1 having html document.in this html file some data of
word file is existing.like if strFilename have "Hello World" and
strFileName1 also have "Hello World" like this
now i have to compare these two string.if i select "Hello world" in
first string and click button then if any word of "Hello World" missing
in second string(like "Hello Word") then it will be displayed
highlight.L is missing then L should be marked in second string

That's it..plz help me if u know about it
Twinkle
Morten Wennevik wrote:
>Hi Twinkle,

I'm not sure what you are asking for.

Do you have two almost identical strings and want to mark the differences (like comparing a document with its older version)? Or do you have mean string1 is a list of words that should occur at least once in string2, and mark missing words?

When you mean highlight missing words, what do you mean? Strings can't be highlighted, but you can add codes that will cause words to be highlighted when displayed in various ways. How to highlight a word very much depends on what you display it with.

If string1 is "Hello World." and string2 is "Hello. How are you." What do you expect to happen?

On Sat, 12 Aug 2006 12:15:56 +0200, Twinkle <he*************@gmail.comwrote:
HI there
i want to compare between two strings char by char.every
strings having a word document.first string name is strFileName and
second string name is strFilename1.
i want to compare strFileName with strFileName1.if there is any mistek
or some word is missing in second string then that words should be
highlight(in sense change the color of that words) by the button click
event.
pls somebody give an idea to me.

Twinkle


--
Happy coding!
Morten Wennevik [C# MVP]



--
Happy coding!
Morten Wennevik [C# MVP]
Aug 12 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.