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.
  • 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
    StatementTerminator
    wrote on last edited by
    #56

    Wow, go do some string manipulations in ANSI C, that'll give you something to complain about :) As a general rule, the more powerful the language the more responsibility the programmer has for implementing algorithms correctly. Checking bounds before taking a bite out of an array is basic stuff, why should the language hold your hand for that? This kind of thing annoys me about VB, getting back a string that is shorter than the length you specified is like just having the language ignore an exception and give an arbitrary result. It's not what you asked for, and you shouldn't get it. What if code down the line is expecting the string to be that exact length?

    Z 1 Reply Last reply
    0
    • S StatementTerminator

      Wow, go do some string manipulations in ANSI C, that'll give you something to complain about :) As a general rule, the more powerful the language the more responsibility the programmer has for implementing algorithms correctly. Checking bounds before taking a bite out of an array is basic stuff, why should the language hold your hand for that? This kind of thing annoys me about VB, getting back a string that is shorter than the length you specified is like just having the language ignore an exception and give an arbitrary result. It's not what you asked for, and you shouldn't get it. What if code down the line is expecting the string to be that exact length?

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

      StatementTerminator wrote:

      This kind of thing annoys me about VB, getting back a string that is shorter than the length you specified is like just having the language ignore an exception and give an arbitrary result.

      Not even close. It's like being a human. If you asked someone, "hey, give me the first 100 characters of the phrase 'i love VB'", would you expect them to yell at you with an exception or to just return your string? Maybe you think too much like a computer instead of a human. :-\

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

      S 1 Reply Last reply
      0
      • Z ZurdoDev

        StatementTerminator wrote:

        This kind of thing annoys me about VB, getting back a string that is shorter than the length you specified is like just having the language ignore an exception and give an arbitrary result.

        Not even close. It's like being a human. If you asked someone, "hey, give me the first 100 characters of the phrase 'i love VB'", would you expect them to yell at you with an exception or to just return your string? Maybe you think too much like a computer instead of a human. :-\

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

        S Offline
        S Offline
        StatementTerminator
        wrote on last edited by
        #58

        RyanDev wrote:

        If you asked someone, "hey, give me the first 100 characters of the phrase 'i love VB'", would you expect them to yell at you with an exception or to just return your string?

        I would expect different answers from different people, which is exactly the point. And yes, I would be the elephanting Vulcan who says that the question is unanswerable, because what is being asked for can't be given.

        Z 1 Reply Last reply
        0
        • D den2k88

          My tantrum is directeed to the pile of sunshine that is the .NET framework, in fact I usually make my own libraries anyway. Still for a "framework" so bloated not having a simple and fundamental function is basically an indication of utter failure.

          GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani

          S Offline
          S Offline
          Super Lloyd
          wrote on last edited by
          #59

          Yes, just like you, I wouldn't use the .NET Framework for anything, obviously! It doesn't even have a .Left() method on string, for god's sake man! Who make that shit?! :omg: :laugh:

          All in one Menu-Ribbon Bar DirectX for WinRT/C# since 2013! Taking over the world since 1371!

          1 Reply Last reply
          0
          • S StatementTerminator

            RyanDev wrote:

            If you asked someone, "hey, give me the first 100 characters of the phrase 'i love VB'", would you expect them to yell at you with an exception or to just return your string?

            I would expect different answers from different people, which is exactly the point. And yes, I would be the elephanting Vulcan who says that the question is unanswerable, because what is being asked for can't be given.

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

            Give me the first 100 digits of 10. :laugh:

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

            S 2 Replies 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.

              U Offline
              U Offline
              User 7689520
              wrote on last edited by
              #61

              Add a reference to Visual Basic and just use the left function from VB

              string test = "Hello World";
              string shortTest = Microsoft.VisualBasic.Strings.Left(test, 5);
              Console.WriteLine(shortTest);

              Z 1 Reply Last reply
              0
              • U User 7689520

                Add a reference to Visual Basic and just use the left function from VB

                string test = "Hello World";
                string shortTest = Microsoft.VisualBasic.Strings.Left(test, 5);
                Console.WriteLine(shortTest);

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

                I know.

                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.

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

                  Func<string, int, string> Left = ( s, n ) => s.PadRight( n + 1 ).Remove( n );

                  Console.WriteLine( Left( "FooBar", 3 ) );
                  Console.WriteLine( Left( "", 6 ) + "*" );

                  Console.ReadKey();

                  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.

                    H Offline
                    H Offline
                    Herbie Mountjoy
                    wrote on last edited by
                    #64

                    I miss VB too. Somehow it's very good at dodging bullets. We're philosophical about power outages here. A.C. come, A.C. go.

                    1 Reply Last reply
                    0
                    • Z ZurdoDev

                      Give me the first 100 digits of 10. :laugh:

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

                      S Offline
                      S Offline
                      StatementTerminator
                      wrote on last edited by
                      #65

                      Does...not...compute...*sparks fly* *head explodes* Happy now, VB murderer?

                      1 Reply Last reply
                      0
                      • Z ZurdoDev

                        Give me the first 100 digits of 10. :laugh:

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

                        S Offline
                        S Offline
                        StatementTerminator
                        wrote on last edited by
                        #66

                        10.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

                        Z 1 Reply Last reply
                        0
                        • S StatementTerminator

                          10.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

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

                          Exactly.

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

                          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