String manipulation - remove before '\' character

Author Message
heymishy

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 7/4/2011
  • Status: offline
String manipulation - remove before '\' character Monday, July 04, 2011 8:07 PM (permalink)
0
Hi everyone,

Im very much a casual dev, more of a technical analyst, but i have to knock up a VBScript to drop of the domain from a username.

basically what I have is a username returned as 'domain\username' in the username and need to get just the value after the '\'

What I currently have works, but appears to render quite slowly, and may not be the best method. So if anyone has a more efficient / smoother way of achieving the same result - I'd be all ears!


** Trim the domain from the username trimloc = InStr(username, "\") int = cint(trimloc) trimloc = int + 1 username = mid(username, trimLoc) 



Really appreciate the input from a part-time dev!

Regards,
Hamish.
<message edited by heymishy on Monday, July 04, 2011 8:22 PM>
 
#1
    mcnd

    • Total Posts : 50
    • Scores: 2
    • Reward points : 0
    • Joined: 4/27/2008
    • Status: offline
    Re:String manipulation - remove before '\' character Monday, July 04, 2011 11:56 PM (permalink)
    0
     username = Split( username, "\")(1) 

     
    #2
      heymishy

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 7/4/2011
      • Status: offline
      Re:String manipulation - remove before '\' character Tuesday, July 05, 2011 10:48 AM (permalink)
      0
      Wow - that really is a more efficient solution.. thanks! Script still running a bit slow, so must be different part of the code.. back to debugging!
       
      thanks mcnd!
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9