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

Take a part of a string and putting into another string

Status
Not open for further replies.

Quijian

ISP
Jul 9, 2004
32
US
Is it possible to take a portion of a string, forinstance and put into in another string or variable? Thanks, I'll take any suggestions.
 
Hi

Code:
Function InsertInto(s1 As String, s2 As String, p1 As Integer) As String
   InsertInto = Left(s2, Len(s2) - p1 - 1) & s1 & Right(s2, p1 + 1)
End Function
where s1 is the string to insert
s2 is the string to be inserted into
p1 is the position to put s1

Skip,

[red]Be advised:[/red] [glasses]
Alcohol and Calculus do not mix!
If you drink, don't derive! [tongue]
 
Look up the Mid function.

strNewValue = Mid(string, start[, length])


Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Also remember the Mid Statement:

Mid(stringvar, start[, length]) = string

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top