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. Other Discussions
  3. The Weird and The Wonderful
  4. Ran across my old code... Must have been tired...

Ran across my old code... Must have been tired...

Scheduled Pinned Locked Moved The Weird and The Wonderful
4 Posts 2 Posters 0 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    public static string Maximum( this string input, int max ) {
    if ( input != null && input.Length > 0 ) {
    if ( input.Length > max ) {
    return input.Substring( 0, max );
    }
    return input.Substring( 0, input.Length ); //wtf have i done...
    }
    return input;
    }

    :wtf:

    “I have no special talents. I am only passionately curious.” - Albert Einstein

    L E 2 Replies Last reply
    0
    • L Lost User

      public static string Maximum( this string input, int max ) {
      if ( input != null && input.Length > 0 ) {
      if ( input.Length > max ) {
      return input.Substring( 0, max );
      }
      return input.Substring( 0, input.Length ); //wtf have i done...
      }
      return input;
      }

      :wtf:

      “I have no special talents. I am only passionately curious.” - Albert Einstein

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

      LiveFreeCodeHard wrote:

      CodeHard

      Your name starts making sense now. :-)

      L 1 Reply Last reply
      0
      • L Lost User

        LiveFreeCodeHard wrote:

        CodeHard

        Your name starts making sense now. :-)

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

        Ha! Yeah, limits on all the things! Need a string, better use char[50]! Want a byte value, better use bool[8]!

        “I have no special talents. I am only passionately curious.” - Albert Einstein

        1 Reply Last reply
        0
        • L Lost User

          public static string Maximum( this string input, int max ) {
          if ( input != null && input.Length > 0 ) {
          if ( input.Length > max ) {
          return input.Substring( 0, max );
          }
          return input.Substring( 0, input.Length ); //wtf have i done...
          }
          return input;
          }

          :wtf:

          “I have no special talents. I am only passionately curious.” - Albert Einstein

          E Offline
          E Offline
          ekolis
          wrote on last edited by
          #4

          And I thought the WTF was a "maximum" function which takes a string and an int, until I saw the comment...

          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