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!

First Initial Last Name 1

Status
Not open for further replies.

Webflex

Technical User
Apr 20, 2001
101
0
0
GB
Hi

I currently use the code below (very helpfully supplied through this forum) to populate a users full name into a form field, I now want to take the first initial and surname to make part of an e-mail address (which will work in a large percentage of cases). How can I truncate strNTUserFullName into the shorter version?

Code:
<% 'Vars 
dim strNTUser
dim strNTUserInfo
dim strNTUserFullName

	' COMPILE FULL USER NAME

	strNTUser = Request.ServerVariables(&quot;AUTH_USER&quot;)
	strNTUser = replace(strNTUser, &quot;\&quot;, &quot;/&quot;) 
	strNTUserFullName = Session(&quot;strNTUserFullName&quot;) 
	if Session(&quot;strNTUserFullName&quot;) = &quot;&quot; then 
		Set strNTUserInfo = GetObject(&quot;WinNT://&quot;+strNTUser) 
		strNTUserFullName=strNTUserInfo.FullName
	end if 

' SET FULL USER NAME SESSION
Session(&quot;GENUID&quot;) = strNTUserFullName %>

TIA
Webflex
 
one thing
which will work in a large percentage of cases

from a analytical stand point that would not be exceptable, but if that is a % you and your company can live with then..

to get the first initial you would use a combination (if the first and last name are combined) of the Mid() function to grab the space in the name and the the left() function to get the first character of the value.

if the last name is segragated from the first then a simple Left(string,1)

you can find plenty of how to's on these string manipulative functions at
under the vbscript section

___________________________________________________________________
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
Thnks, unfortunately a bad choice of mail naming convention means the address is not entirely predictable, in about 95% of cases it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top