473,770 Members | 6,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compare Two Strings

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
3 3690
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.comwrot e:
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
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.comwrot e:
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
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.comwrot e:
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.comwrot e:
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
76530
by: J.W. | last post by:
How do I compare strings in javascript? The "==" double equals or "!=" doesn't seem to work in this case. I'm sure string comparison has been explained before but searching Google didn't find any code that looked similar to this one: ----- function CheckPassword(val,val2, str) { var strInput = new String(val.value);
1
2661
by: al | last post by:
To compare two strings, not just to see if they are "equal" ("abcd"="abcd") but tell their alphabetical order: string a, b; a = "abcd"; b = "bbcd"; Can all the ways below to do such comparison? 1. a > b
3
3195
by: Drew | last post by:
Hello - I am a converted VB programmer. What I am trying to do it compare two strings in an if statement. The problem is that when I use string.compare it always returns a negative 1. I have entered the same string, different strings. The string is loaded from the results from a dataset. The other string is loaded from a textbox. Could someone please help me in this situation?
14
2417
by: Samuel R. Neff | last post by:
Why would you cast two strings to objects to compare them? I saw code in an MS sample on MSDN and don't get it. if ( (object)name == (object)attr.name ) { both "name" and "attr.name" are declared as string. http://msdn.microsoft.com/XML/BuildingXML/XMLinNETFramework/default.aspx?pull=/library/en-us/dnxmlnet/html/XmlBkMkRead.asp Thanks,
3
2486
by: Jim Carlock | last post by:
I'm creating a lot of arrays. Some of the arrays carry words that get duplicated... For example: $aCities = {"Durham", "Raleigh", "Raleigh-Durham", "Salem", "Winston", "Winston-Salem" } I've been using stristr alot but that ends up meaning that I must take the arrays out of alphabetical order and in the end it complicates things on my part. I'll comparing it to the strcmp() function right at the moment but I ran into some
0
2308
by: Diego Martins | last post by:
Hi! The following code snippet: namespace { bool charCompare(char a, char b) { return tolower(a) < tolower(b); } } bool compareString(const std::string & s1, const std::string & s2) {
1
1512
by: lawrence k | last post by:
Can I check alphabeticallness as easily as "aaa" "bgeoid" ? $var1 = "cccccc"; $var2 = "f"; if ($var1 $var2) {
2
1575
by: jonathan184 | last post by:
Hi I am trying to use if statements to search strings on each line and if it finds matches to the string write to a variable and then echo variable and the loop starts again. The match is being found fine but anything under the matched record is getting the same value of the variable when there is no match. I tried if and elseif and i get the same problem this is the code i am using in the loop. Could somebody help me please. ...
6
17597
by: shapper | last post by:
Hello, I want to compare two strings in a Linq Query. In this case "Car", "cAr", "CAR" would all be the same. Should I use ==, equals, ... ? What is the best way to do this?
2
1884
by: Thenu | last post by:
Im doing my project in Asp .net with Vb .net Coding.... I have some Problem in doing my project... If anybody Guide me means it would be great pleasure for me.. I want to compare the strings.Its about Disambiguate Doctors profile... If there are four or five members having same name i have to check whether they are same person or not ... If i have smith for five times in my table then i have to check all the five persons like,by having...
0
9592
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...
1
10005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9871
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...
0
8887
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
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
6679
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
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
3
2817
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.