What is the C# equivalent of vb Chr() function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DragonLord
    New Member
    • Mar 2007
    • 122

    #31
    i get bad compile constant on the "\u"

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #32
      See what happens when I don't check my assumptions.
      In hind sight that makes sense. You can't ask for the unicode of nothing.

      Comment

      • DragonLord
        New Member
        • Mar 2007
        • 122

        #33
        What are you talking about when i do your label example or my message box.show it works just fine, if there is something wrong with what i am doing i sure would appreciate some advice on how to fix it.

        Comment

        • DragonLord
          New Member
          • Mar 2007
          • 122

          #34
          considering the following is a c# standard

          5 vote down check


          C# is trying to interpret \d as an escape sequence, and \d is not a valid escape sequence (but \n and \t are, for example). You can either double up the backslashes to escape it ("^(\\d){4}$ "), or you can prefix the constant string with an at-sign: @"^(\d){4}$" .


          I would be interested in your 'wise' answer on why you get away with yours working without the extra \ or @ seams maybe you are overriding some features.

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #35
            Code:
            [B]DL: [/B]strText = "\u" + (c.ToString()).PadLeft(4, (char)48));
            i get bad compile constant on the "\u"

            tlhIn'toq: See what happens when I don't check my assumptions.
            In hind sight that makes sense. You can't ask for the unicode of nothing.

            DL: What are you talking about when i do your label example or my message box.show it works just fine,

            tlhIn'toq: Right. When formatted as in the labels examples it works. When you have it by itself "\u" its a bad compile because you can't get the unicode of nothing.

            DL: considering the following is a c# standard
            5 vote down check

            tlhIn'toq: Huh? "5 vote down check". I can't even guess what that is supposed to be, let alone relate it to a C# standard.


            Like I said - To me it looks like 10 times too much work because a lot of control codes are trying to be converted to strings for some reason unknown to me. I suspect the architecture needs a complete overhaul so as to just send bytes and stop trying to make it all look human readable. Not everything the computer does is going to be human readable.

            Comment

            Working...