Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Fine, I'll jump on the "I hate Microsoft" bandwagon

Fine, I'll jump on the "I hate Microsoft" bandwagon

Scheduled Pinned Locked Moved The Lounge
67 Posts 26 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 9 9082365

    RyanDev wrote:

    Errors if you give it a length that is longer than the string.

    As one would jolly well hope it did. I don't see why MS should take stick for your faulty programming logic.

    I am not a number. I am a ... no, wait!

    Z Offline
    Z Offline
    ZurdoDev
    wrote on last edited by
    #4

    9082365 wrote:

    As one would jolly well hope it did

    No way. VB's LEFT function truncated it for you, which is of course what I would want it to do. Oh, so easy.

    There are only 10 types of people in the world, those who understand binary and those who don't.

    1 Reply Last reply
    0
    • Z ZurdoDev

      So, C# has no left method on a string? :omg: :omg: It would be so easy to add one, lazy Microsoft C# developers. So, use substring. Whoops. Nope. Errors if you give it a length that is longer than the string. I miss VB. :sigh:

      There are only 10 types of people in the world, those who understand binary and those who don't.

      S Offline
      S Offline
      Scott Serl
      wrote on last edited by
      #5

      Here you go:

          public static string Left(this string theString, int length)
          {
              int sz = length > theString.Length + 1 ? theString.Length:length;
      
              return theString.Substring(0, sz);
          }
      
      Z Richard DeemingR J 3 Replies Last reply
      0
      • S Scott Serl

        Here you go:

            public static string Left(this string theString, int length)
            {
                int sz = length > theString.Length + 1 ? theString.Length:length;
        
                return theString.Substring(0, sz);
            }
        
        Z Offline
        Z Offline
        ZurdoDev
        wrote on last edited by
        #6

        Don't give me workarounds when all I want to do is complain. :mad: I know it's super simple to write one myself, but the point is I should not have to. Seems pretty basic.

        There are only 10 types of people in the world, those who understand binary and those who don't.

        R M 2 Replies Last reply
        0
        • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

          You have to start to build your own - fixed - library of extension methods...

          Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

          M Offline
          M Offline
          Mark_Wallace
          wrote on last edited by
          #7

          Yup. Phones getting bigger, having to press a button to see the time on your watch, having to write your own extensions... The seventies are back, for certain.

          I wanna be a eunuchs developer! Pass me a bread knife!

          Kornfeld Eliyahu PeterK L 2 Replies Last reply
          0
          • Z ZurdoDev

            Don't give me workarounds when all I want to do is complain. :mad: I know it's super simple to write one myself, but the point is I should not have to. Seems pretty basic.

            There are only 10 types of people in the world, those who understand binary and those who don't.

            R Offline
            R Offline
            R Giskard Reventlov
            wrote on last edited by
            #8

            Why not just ref the VB assembly and... oh, I can't keep it up. :-)

            Z 1 Reply Last reply
            0
            • Z ZurdoDev

              Don't give me workarounds when all I want to do is complain. :mad: I know it's super simple to write one myself, but the point is I should not have to. Seems pretty basic.

              There are only 10 types of people in the world, those who understand binary and those who don't.

              M Offline
              M Offline
              Mark_Wallace
              wrote on last edited by
              #9

              RyanDev wrote:

              Don't give me workarounds when all I want to do is complain.

              i confess that that is something that grandly pisses me off.

              RyanDev wrote:

              I know it's super simple to write one myself, but the point is I should not have to.

              It's that it was taken away because some moron decided for you that you didn't need it; that's what gets the teeth grinding.

              I wanna be a eunuchs developer! Pass me a bread knife!

              Z D 2 Replies Last reply
              0
              • R R Giskard Reventlov

                Why not just ref the VB assembly and... oh, I can't keep it up. :-)

                Z Offline
                Z Offline
                ZurdoDev
                wrote on last edited by
                #10

                Strings.Left Method (String, Int32) (Microsoft.VisualBasic)[^] :thumbsup: :-\

                There are only 10 types of people in the world, those who understand binary and those who don't.

                1 Reply Last reply
                0
                • M Mark_Wallace

                  RyanDev wrote:

                  Don't give me workarounds when all I want to do is complain.

                  i confess that that is something that grandly pisses me off.

                  RyanDev wrote:

                  I know it's super simple to write one myself, but the point is I should not have to.

                  It's that it was taken away because some moron decided for you that you didn't need it; that's what gets the teeth grinding.

                  I wanna be a eunuchs developer! Pass me a bread knife!

                  Z Offline
                  Z Offline
                  ZurdoDev
                  wrote on last edited by
                  #11

                  Mark_Wallace wrote:

                  It's that it was taken away

                  Not sure C# ever had it. :^)

                  There are only 10 types of people in the world, those who understand binary and those who don't.

                  M 1 Reply Last reply
                  0
                  • M Mark_Wallace

                    Yup. Phones getting bigger, having to press a button to see the time on your watch, having to write your own extensions... The seventies are back, for certain.

                    I wanna be a eunuchs developer! Pass me a bread knife!

                    Kornfeld Eliyahu PeterK Offline
                    Kornfeld Eliyahu PeterK Offline
                    Kornfeld Eliyahu Peter
                    wrote on last edited by
                    #12

                    Ecclesiastes 1, 9:

                    That which hath been is that which shall be, and that which hath been done is that which shall be done; and there is nothing new under the sun.

                    Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                    M 1 Reply Last reply
                    0
                    • Z ZurdoDev

                      Mark_Wallace wrote:

                      It's that it was taken away

                      Not sure C# ever had it. :^)

                      There are only 10 types of people in the world, those who understand binary and those who don't.

                      M Offline
                      M Offline
                      Mark_Wallace
                      wrote on last edited by
                      #13

                      Um...[^]

                      I wanna be a eunuchs developer! Pass me a bread knife!

                      Z 1 Reply Last reply
                      0
                      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                        Ecclesiastes 1, 9:

                        That which hath been is that which shall be, and that which hath been done is that which shall be done; and there is nothing new under the sun.

                        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                        M Offline
                        M Offline
                        Mark_Wallace
                        wrote on last edited by
                        #14

                        Is there a chapter and verse that gives a get-out from wearing flares and an afro?

                        I wanna be a eunuchs developer! Pass me a bread knife!

                        Kornfeld Eliyahu PeterK 1 Reply Last reply
                        0
                        • M Mark_Wallace

                          Um...[^]

                          I wanna be a eunuchs developer! Pass me a bread knife!

                          Z Offline
                          Z Offline
                          ZurdoDev
                          wrote on last edited by
                          #15

                          Um what? Microsoft.VisualBasic. And it's still there.

                          There are only 10 types of people in the world, those who understand binary and those who don't.

                          M 1 Reply Last reply
                          0
                          • M Mark_Wallace

                            RyanDev wrote:

                            Don't give me workarounds when all I want to do is complain.

                            i confess that that is something that grandly pisses me off.

                            RyanDev wrote:

                            I know it's super simple to write one myself, but the point is I should not have to.

                            It's that it was taken away because some moron decided for you that you didn't need it; that's what gets the teeth grinding.

                            I wanna be a eunuchs developer! Pass me a bread knife!

                            D Offline
                            D Offline
                            Deflinek
                            wrote on last edited by
                            #16

                            Guys, you are aware that features are unimplemented by default[^], right?

                            -- "My software never has bugs. It just develops random features."

                            M 1 Reply Last reply
                            0
                            • D Deflinek

                              Guys, you are aware that features are unimplemented by default[^], right?

                              -- "My software never has bugs. It just develops random features."

                              M Offline
                              M Offline
                              Mark_Wallace
                              wrote on last edited by
                              #17

                              But it was implemented. I'm now recompiling everything I've ever written in C#, to insert workarounds. It's a very happy job, as I'm sure you can imagine.

                              I wanna be a eunuchs developer! Pass me a bread knife!

                              1 Reply Last reply
                              0
                              • M Mark_Wallace

                                Yup. Phones getting bigger, having to press a button to see the time on your watch, having to write your own extensions... The seventies are back, for certain.

                                I wanna be a eunuchs developer! Pass me a bread knife!

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #18

                                Quote:

                                The seventies are back, for certain.

                                Except for the music! There is no music anymore! X|

                                Get me coffee and no one gets hurt!

                                M W 2 Replies Last reply
                                0
                                • Z ZurdoDev

                                  Um what? Microsoft.VisualBasic. And it's still there.

                                  There are only 10 types of people in the world, those who understand binary and those who don't.

                                  M Offline
                                  M Offline
                                  Mark_Wallace
                                  wrote on last edited by
                                  #19

                                  On the VB tab, it gives the VB syntax:

                                  Public Shared Function Left (
                                  str As String,
                                  Length As Integer
                                  ) As String

                                  On the C# tab, it gives the C# syntax:

                                  public static string Left(
                                  string str,
                                  int Length
                                  )

                                  I know that computery things seem complicated, Granny, but you ought to at least try to use them.

                                  I wanna be a eunuchs developer! Pass me a bread knife!

                                  Z 1 Reply Last reply
                                  0
                                  • L Lost User

                                    Quote:

                                    The seventies are back, for certain.

                                    Except for the music! There is no music anymore! X|

                                    Get me coffee and no one gets hurt!

                                    M Offline
                                    M Offline
                                    Mark_Wallace
                                    wrote on last edited by
                                    #20

                                    Oh, there is, but the definition of the word "music" has changed to be something to do with money for nothing.

                                    I wanna be a eunuchs developer! Pass me a bread knife!

                                    L M 2 Replies Last reply
                                    0
                                    • M Mark_Wallace

                                      On the VB tab, it gives the VB syntax:

                                      Public Shared Function Left (
                                      str As String,
                                      Length As Integer
                                      ) As String

                                      On the C# tab, it gives the C# syntax:

                                      public static string Left(
                                      string str,
                                      int Length
                                      )

                                      I know that computery things seem complicated, Granny, but you ought to at least try to use them.

                                      I wanna be a eunuchs developer! Pass me a bread knife!

                                      Z Offline
                                      Z Offline
                                      ZurdoDev
                                      wrote on last edited by
                                      #21

                                      You're still missing what namespace the function is in. :doh:

                                      There are only 10 types of people in the world, those who understand binary and those who don't.

                                      M 1 Reply Last reply
                                      0
                                      • M Mark_Wallace

                                        Is there a chapter and verse that gives a get-out from wearing flares and an afro?

                                        I wanna be a eunuchs developer! Pass me a bread knife!

                                        Kornfeld Eliyahu PeterK Offline
                                        Kornfeld Eliyahu PeterK Offline
                                        Kornfeld Eliyahu Peter
                                        wrote on last edited by
                                        #22

                                        Maybe...

                                        Deuteronomy 22, 5:

                                        A woman shall not wear that which pertaineth unto a man, neither shall a man put on a woman's garment...

                                        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                                        "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                                        M 1 Reply Last reply
                                        0
                                        • Z ZurdoDev

                                          You're still missing what namespace the function is in. :doh:

                                          There are only 10 types of people in the world, those who understand binary and those who don't.

                                          M Offline
                                          M Offline
                                          Mark_Wallace
                                          wrote on last edited by
                                          #23

                                          Don't bother me with petty details when I'm in panic mode! Looks like I've always used Substring, anyway. Strange, that. It feels like I've used Left much more recently than I've used VB. {Insert Sid James comment here]

                                          I wanna be a eunuchs developer! Pass me a bread knife!

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups