strings comparison

D

Dariusz Tomon

Hello

I'm trying to compare two strings:

1. retrieved from custom xmlplaceholder (Microsoft CMS):
zrodlo = fact.Placeholders["kategoria2"] as XmlPlaceholder;

esc_kat2 = Server.HtmlEncode(zrodlo.XmlAsString);

esc_kat2 = esc_kat2.Replace("<","");

esc_kat2 = esc_kat2.Replace(">","");

esc_kat2 = esc_kat2.Replace("/Zones","");

esc_kat2 = esc_kat2.Replace("/Zone","");

esc_kat2 = esc_kat2.Replace("Zones","");

kategoria2 = esc_kat2.Replace("Zone","");


String kategoria2 has my nationals characters translated into unicode and
looks like this:

"orzecznictwo do celów pozarentowych"

2. The second one is retrieved from SQL database:

selectCmd = "select * from urzond_main order by id";

myCommand = new SqlCommand(selectCmd, myConnection);

myConnection.Open();

myReader = myCommand.ExecuteReader();



while (myReader.Read())

{

kategoria1 = myReader.GetSqlString(1).ToString();

}



String kategoria1 has original national characters without being
translated into unicode:

orzecznictwo do celów pozarentowych



I cannot compare these strings 'cos they are different.

What is the best advice? Please give some code portion with an advice.

Best Regards



Darek
 
C

Cor Ligthert [MVP]

Darek,

(sent accidently to the emailaddress first)

I don't believe in "best methods" otherwise there was a standard method.

It is your decission how something is the same. If it is needed that:

Walensa has to be the same as Walesa, than it is probably very difficult to do if for that is not somehwere a Polish routine on the InterNet.

However if it has to be Walesa than you can look for this methods.

http://msdn.microsoft.com/library/d...fsystemtextencodingclassgetencodingtopic1.asp


Here some links to used code pages.

Unicode
http://www.geocities.com/Athens/Academy/4038/graph/fontset.htm#b

OS systems

http://www.microsoft.com/globaldev/reference/oslocversion.mspx

I hope this helps a little bit?

Cor
 

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

Similar Threads

string comparison 1

Top