HighTechTalks DotNet Forums  

Unicode Comparison.

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Unicode Comparison. in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Max
 
Posts: n/a

Default Unicode Comparison. - 09-05-2006 , 02:13 AM






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.


Reply With Quote
  #2  
Old   
Morten Wennevik
 
Posts: n/a

Default Re: Unicode Comparison. - 09-05-2006 , 03:00 AM






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[i]) + ";";

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[i] = (char)int.Parse(ts[i].Substring(2));

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

On Tue, 05 Sep 2006 08:13:10 +0200, Max <mahesh.anjani (AT) gmail (DOT) com> wrote:

Quote:
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.



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


Reply With Quote
  #3  
Old   
Miha Markic [MVP C#]
 
Posts: n/a

Default Re: Unicode Comparison. - 09-05-2006 , 03:04 AM



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/

"Max" <mahesh.anjani (AT) gmail (DOT) com> wrote

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.



Reply With Quote
  #4  
Old   
Morten Wennevik
 
Posts: n/a

Default Re: Unicode Comparison. - 09-05-2006 , 03:08 AM



Looks like you need to enable unicode in your news reader Miha


On Tue, 05 Sep 2006 09:04:41 +0200, Miha Markic [MVP C#] <miha at rthand
<"com>"> wrote:

Quote:
Hi Max,

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



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


Reply With Quote
  #5  
Old   
Cor Ligthert [MVP]
 
Posts: n/a

Default Re: Unicode Comparison. - 09-05-2006 , 01:08 PM



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" <mahesh.anjani (AT) gmail (DOT) com> schreef in bericht
news:1157436790.576087.177630 (AT) i42g2000cwa (DOT) googlegroups.com...
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.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.