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. General Programming
  3. C#
  4. Left Function in C#

Left Function in C#

Scheduled Pinned Locked Moved C#
csharpquestion
6 Posts 4 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.
  • M Offline
    M Offline
    MyRunner23
    wrote on last edited by
    #1

    Hi All, anyone know the left function in C#? Thanks

    J E 2 Replies Last reply
    0
    • M MyRunner23

      Hi All, anyone know the left function in C#? Thanks

      J Offline
      J Offline
      Jon Sagara
      wrote on last edited by
      #2

      String.Substring(start, length)[^]

      Jon Sagara When I grow up, I'm changing my name to Joe Kickass! My Site | My Blog | My Articles

      1 Reply Last reply
      0
      • M MyRunner23

        Hi All, anyone know the left function in C#? Thanks

        E Offline
        E Offline
        Eric Dahlvang
        wrote on last edited by
        #3

        String cMyString = "This is my string";
        MessageBox.Show(cMyString.Substring(0,5));

        [edit]oops...Jon got here first...[/edit]

        --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

        S 1 Reply Last reply
        0
        • E Eric Dahlvang

          String cMyString = "This is my string";
          MessageBox.Show(cMyString.Substring(0,5));

          [edit]oops...Jon got here first...[/edit]

          --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

          S Offline
          S Offline
          samtam
          wrote on last edited by
          #4

          Fellows i didnt get it. why is it called "Left", further clarify me thanks in advance

          E 1 Reply Last reply
          0
          • S samtam

            Fellows i didnt get it. why is it called "Left", further clarify me thanks in advance

            E Offline
            E Offline
            Eric Dahlvang
            wrote on last edited by
            #5

            There is no "LEFT" function, but you can use Substring to return the left portion of a string: The following will display: This

            String cMyString = "This is my string";
            MessageBox.Show(cMyString.Substring(0, 4));

            The following will display: This is

            MessageBox.Show(cMyString.Substring(0, 7));

            --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

            S 1 Reply Last reply
            0
            • E Eric Dahlvang

              There is no "LEFT" function, but you can use Substring to return the left portion of a string: The following will display: This

              String cMyString = "This is my string";
              MessageBox.Show(cMyString.Substring(0, 4));

              The following will display: This is

              MessageBox.Show(cMyString.Substring(0, 7));

              --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

              S Offline
              S Offline
              samtam
              wrote on last edited by
              #6

              Thanks alot i was only confused coz of the term 'LEFT', otherwise i know how to use this method.

              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