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. How do i strip down a string to just show a user name in Active directory

How do i strip down a string to just show a user name in Active directory

Scheduled Pinned Locked Moved C#
comwindows-adminquestion
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.
  • P Offline
    P Offline
    partialdata
    wrote on last edited by
    #1

    I have a app that list users that are locked out but it shows this in my combobox billy-Noel Schmitlin,OU=Quality-Labo,OU=Users,OU=Soultz,DC=jacob-wonder,DC=com i just want it to show "Billy-Noel" just the users name what i have searched removes the CN= but thats it strName = strName.Remove(0, 3); Thank you for your time.

    L I 2 Replies Last reply
    0
    • P partialdata

      I have a app that list users that are locked out but it shows this in my combobox billy-Noel Schmitlin,OU=Quality-Labo,OU=Users,OU=Soultz,DC=jacob-wonder,DC=com i just want it to show "Billy-Noel" just the users name what i have searched removes the CN= but thats it strName = strName.Remove(0, 3); Thank you for your time.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, Split() on the first char you don't want, I guess that is a comma. And read up on string class. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      N 1 Reply Last reply
      0
      • P partialdata

        I have a app that list users that are locked out but it shows this in my combobox billy-Noel Schmitlin,OU=Quality-Labo,OU=Users,OU=Soultz,DC=jacob-wonder,DC=com i just want it to show "Billy-Noel" just the users name what i have searched removes the CN= but thats it strName = strName.Remove(0, 3); Thank you for your time.

        I Offline
        I Offline
        IceWater42
        wrote on last edited by
        #3

        or you could try: int i = yourString.IndexOf(","); string s = yourString.SubString(0,i);

        P 1 Reply Last reply
        0
        • L Luc Pattyn

          Hi, Split() on the first char you don't want, I guess that is a comma. And read up on string class. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


          N Offline
          N Offline
          Nagy Vilmos
          wrote on last edited by
          #4

          Some mupet-numb-nuts gave you onesy, so I've dropped a five on top to make it better.


          Panic, Chaos, Destruction. My work here is done.

          L 1 Reply Last reply
          0
          • N Nagy Vilmos

            Some mupet-numb-nuts gave you onesy, so I've dropped a five on top to make it better.


            Panic, Chaos, Destruction. My work here is done.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            :thumbsup:

            Luc Pattyn [Forum Guidelines] [My Articles]


            The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


            1 Reply Last reply
            0
            • I IceWater42

              or you could try: int i = yourString.IndexOf(","); string s = yourString.SubString(0,i);

              P Offline
              P Offline
              partialdata
              wrote on last edited by
              #6

              Thanks for the help ill give that a go. -Summey

              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