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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only return a part of a string

Status
Not open for further replies.

ptuck

MIS
Aug 8, 2003
130
US
I did a search, but did not find exactly what I was looking for. I am trying to only pull the user name from the Request.ServerVariables("LOGON_USER"). The first 11 characters is the domain and a slash. All I want is the user name. What is the best way to do this?

Thanks,
Paul
 
Code:
function GetLanID()
	Dim strUser,Pos
	strUser = request.servervariables("LOGON_USER")
	pos=instr(strUser,"\")
	GetLanID=mid(strUser,pos+1)
end function

Call it like:

myVar = GetLanID()
 
YOu got it right there. Try this:

Code:
<%
dim sName
dim sNewName

sName = Request.ServerVariables ("LOGON_USER")

sNewName = Right(sName,(len(sName)-11))

Response.write sNewName
%>
Let me know if it works.

Cassidy
 
Thanks...they both worked great. Thanks for the quick response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top