(as i have vb5 and not vb6)
Split
Join
Rinstr (the opposite to instr)
Replace
Thanks
Printable View
(as i have vb5 and not vb6)
Split
Join
Rinstr (the opposite to instr)
Replace
Thanks
Ooh come on man! Those functions are cake to implement.
go to the msdn site and do a search on vb 6 string functions.
they have replacements for them there.
i hate searching in big sites, can anyone give me a link
What's Rinstr? I thought the opposite was called InstrRev
I went looking for a link and found one. They are pretty easy to find.
http://support.microsoft.com/support.../Q188/0/07.ASP
yeah yeah yeah, meg, i wasn't sure, I though it was like "Right instr", ok, thanks for the link meg :)
Now you can add it to your template directory. That's what I did. I just saved the module as VB6 Functions and put it in the module template directory.
Try these, I think I got them all:Code:Public Function Split(Expression As String, Optional Delimiter) As Variant
Dim aSections() As String
Dim sTemp As String
Dim nPos As Long
sTemp = Expression
ReDim aSections(0)
nPos = InStr(sTemp, Delimiter)
Do
nPos = InStr(sTemp, Delimiter)
If nPos Then
aSections(UBound(aSections)) = Left(sTemp, nPos - 1)
Else
aSections(UBound(aSections)) = sTemp
End If
ReDim Preserve aSections(UBound(aSections) + 1)
sTemp = Mid(sTemp, nPos + Len(Delimiter))
Loop While nPos
If UBound(aSections) Then
ReDim Preserve aSections(UBound(aSections) - 1)
Split = aSections
Else
Split = Array()
End If
End Function
Public Function Join(SourceArray, Optional Delimiter) As String
If IsMissing(Delimiter) Then Delimiter = ""
Dim sTemp As String
Dim nIndex As Long
If InStr(LCase(TypeName(SourceArray)), "()") Then
For nIndex = LBound(SourceArray) To UBound(SourceArray)
sTemp = sTemp & SourceArray(nIndex) & Delimiter
Next
End If
Join = Left(sTemp, Len(sTemp) - Len(Delimiter))
End Function
Public Function InStrRev(StringCheck As String, StringMatch As String, Optional Start As Long = -1) As Long
Dim sTemp As String
Dim nChar As Long
Dim nPos As Long
sTemp = Space(Len(StringCheck))
For nChar = 0 To Len(StringCheck) - 1
Mid(sTemp, nChar + 1, 1) = Mid(StringCheck, Len(StringCheck) - nChar, 1)
Next
If Start <= Len(StringCheck) Then
nPos = InStr(IIf(Start = -1, 1, Len(StringCheck) + 1 - Start), sTemp, StringMatch)
End If
InStrRev = IIf(nPos, (Len(StringCheck) + 1) - nPos, 0)
End Function
Public Function Replace(Expression As String, Find As String, ReplaceWith As String, Optional Start As Long = 1, Optional Count As Long = -1) As String
Dim sTemp As String
Dim sNew As String
Dim nChar As Long
Dim nPos As Long
Dim nBegPos As Long
Dim nCount As Long
sTemp = Mid(Expression, Start)
sNew = Left(Expression, Start - 1)
nPos = Start - 1
Do
nPos = InStr(sTemp, Find)
If nPos Then
nCount = nCount + 1
sNew = sNew & Left(sTemp, nPos - 1) & ReplaceWith
sTemp = Mid(sTemp, nPos + Len(Find))
End If
Loop While nPos <> 0 And (nCount < Count And Count > 0)
Replace = sNew & sTemp
End Function
Thanks, Aaron, but that link worked too. Hey, you seem to able to answer me on my qwestions about file types:
http://forums.vb-world.net/showthrea...threadid=18078
In my 1.11 years here, I have never seen him ask a question, only answer questions (with great detail too).