Compare unicode string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Le Minh

    Compare unicode string

    Hi, i write a application to search in a tree. each treenode is a unicode
    text.
    How to compare two unicode string to find extract node i want ?

    Regards
    Minh


  • Chris Mullins

    #2
    Re: Compare unicode string

    All strings in .Net are Unicode strings. Everything is UTF-16 encoded.

    Just use the standard compare algorithms (such as "="), and you'll be fine.

    All you need is:
    if (node1.text == "mytext")


    --
    Chris Mullins, MCSD.NET, MCPD:Enterprise


    "Le Minh" <hanami279@hotm ail.comwrote in message
    news:eC3Q6eC5GH A.3308@TK2MSFTN GP04.phx.gbl...
    Hi, i write a application to search in a tree. each treenode is a unicode
    text.
    How to compare two unicode string to find extract node i want ?
    >
    Regards
    Minh
    >
    >

    Comment

    • Le Minh

      #3
      Re: Compare unicode string


      I fetch some text from web. render text on a browser is good. But when i see
      this text by quick watch, the character is unreadable. For that, when i
      compare it with a unicode string, is not match


      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: Compare unicode string

        Le Minh <hanami279@hotm ail.comwrote:
        I fetch some text from web. render text on a browser is good. But when i see
        this text by quick watch, the character is unreadable. For that, when i
        compare it with a unicode string, is not match
        That suggests you've got an encoding issue somewhere. See
        http://www.pobox.com/~skeet/csharp/d...ngunicode.html for advice.

        --
        Jon Skeet - <skeet@pobox.co m>
        http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
        If replying to the group, please do not mail me too

        Comment

        Working...