Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Compare

Status
Not open for further replies.

Beau71

MIS
Jul 18, 2006
87
US
I am not a programmer, but I do know how to write some code. I was currently asked to change a program that we have that is no longer working and I need to do a string comparison.

I am searching Active Directory and based on the user name I would like to search specific parts of AD. For example, if a user with the User Name 21tuser runs this program I want the AD search to be in the '21' OU.

I don't know how to use string.compare. I tried:
int x = string.compare(strUserid.Substring(2),"21");
if (x=0) and so on
 
i'm unfamilair with AD, but it looks like you need:

Code:
if ( strUserId.StartsWith("21") )
{
 // do stuff
}

mr s. <;)

 
WOW, that was even easier than I imagined!!!
 
You could also use a regex (Regular Expression) if you are searching through a lot of results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top