Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Can someone help me with a string manipulation problem


Message #1 by "Patrick Anigbo" <dirosky@h...> on Mon, 22 Apr 2002 19:40:08
I have a request string that gives a name e.g. John Brown. I want to 
create a string that will be jbrown. I am currently using the following 
code:

strText = Request("user")
intEndOfFname = Instr(strText," ")
str1 = Left(strText, 1)
str2 = mid(strText, intEndOfFname+1, len(strText))

But what I get is JJohn Brown.

What am I doing wrong.

Much appreciated.

Patrick
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 23 Apr 2002 12:27:38 +1000
<%
arrName = Split(strName, " ")

If UBound(arrName) = 1 then
    strAbbreviatedName = Left(arrName(0), 1) & arrName(1)
Else
    Response.Write("Houston, we have a problem.")
End If
%>

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Patrick Anigbo" <dirosky@h...>
Subject: [access_asp] Can someone help me with a string manipulation problem


: I have a request string that gives a name e.g. John Brown. I want to
: create a string that will be jbrown. I am currently using the following
: code:
:
: strText = Request("user")
: intEndOfFname = Instr(strText," ")
: str1 = Left(strText, 1)
: str2 = mid(strText, intEndOfFname+1, len(strText))
:
: But what I get is JJohn Brown.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index