Unicode Comparison.

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

hi

i want to compare a unicode string "અમદાવાદ" with a
string fetched from database, example code is given below.
str contain value fetched from database and
"અમદાવાદ" is unicode of
"અમદાવાદ".

if str = "અમદાવાદ" then

end if

how to do this in asp.net

please let me know if any one has solution.
 
Hi Max,

I'm sure there are better solutions for this (something along the line of
Server.HtmlEncode), but you can always do it the hard way.

string s = "અમદાવાદ";
string t = "અમદાવાદ";

On way (might benefit of a StringBuilder for larger strings)

string ss = "";
for (int i = 0; i < s.Length; i++)
ss += "&#" + ((int)s) + ";";

if(ss == t)
// match

Or the other way around

string[] ts = t.Split(';');
char[] cs = new char[ts.Length - 1];

for (int i = 0; i < cs.Length; i++)
cs = (char)int.Parse(ts.Substring(2));

string tt = new string(cs);
if(s == tt)
// match
 
Hi Max,

Did you simply try
if str ="???????"
?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

hi

i want to compare a unicode string "???????" with a
string fetched from database, example code is given below.
str contain value fetched from database and
"અમદાવાદ" is unicode of
"???????".

if str = "અમદાવાદ" then

end if

how to do this in asp.net

please let me know if any one has solution.
 
Max,

It has in my opinion not much to do with ADONET,

However I think is this is what you need.

http://msdn2.microsoft.com/en-us/library/7c5fyk1k.aspx

I hope this helps,

Cor

"Max" <[email protected]> schreef in bericht
hi

i want to compare a unicode string "???????" with a
string fetched from database, example code is given below.
str contain value fetched from database and
"અમદાવાદ" is unicode of
"???????".

if str = "અમદાવાદ" then

end if

how to do this in asp.net

please let me know if any one has solution.
 

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

Back
Top