|
-
May 31st, 2000, 11:01 PM
#1
Thread Starter
transcendental analytic
Well the InstrRev from the MSDN site was really a joke, as it was frustrating slow, and it got slower the longer strings you put into it. (as it reversed the whole string). Can anyone do another one that doesn't reverse it and still search for my string, btw, i only need one char to search for so that should be pretty easy code for you to make.
Thanks!
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 31st, 2000, 11:24 PM
#2
Fanatic Member
I hope this is what your after. Not perfect i know, but i know you are more than capable of changing it.
Code:
Option Explicit
Private Function myInstrRev(stString As String, stFind As String, Optional iStart As Long) As Long
Dim iCtr As Long
Dim iLen As Integer
Dim iLoopStart As Long
iLen = Len(stFind)
If iStart > 0 Then
If iStart > Len(stString) Then
iStart = Len(stString)
End If
iLoopStart = iStart
Else
iLoopStart = Len(stString)
End If
For iCtr = iLoopStart To 1 Step -1
If Mid$(stString, iCtr, iLen) = stFind Then
myInstrRev = iCtr
Exit Function
End If
Next iCtr
End Function
Private Sub Command1_Click()
MsgBox myInstrRev(Text1.Text, Text2.Text, Val(Text3.Text))
End Sub
Iain, thats with an i by the way!
-
May 31st, 2000, 11:38 PM
#3
Thread Starter
transcendental analytic
Thanks IAin, saved me alot of time!
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 10th, 2000, 05:10 AM
#4
Hyperactive Member
InStrRev
Could you give a very simple example how this function works? ie: i would like to extract the file name from the many exclusive paths within a file.
e:\netvespaweb\5.1.0.10\Customer\drivers\ComCtl32 5.80\50ComUpd.Exe
e:\netvespaweb\5.1.0.10\Customer\drivers\ComCtl32 5.80\ReadMe.Txt
e:\netvespaweb\5.1.0.10\Customer\drivers\DCOM v1.3 for Windows 95\dcom95.exe
e:\netvespaweb\5.1.0.10\Customer\drivers\odbc\mdac_2.1.exe
Many thanks.
-
Aug 10th, 2000, 07:13 AM
#5
Fanatic Member
Righty ho. To start with that InStrRev function above is crap. I have written a much better one since then.
InStrRev
To use it to get a filename.
Code:
strFileName = Right$(strFullName, Len(strFullName) - InStrRev(strFullName, "\"))
Iain, thats with an i by the way!
-
Aug 10th, 2000, 07:29 AM
#6
Hyperactive Member
intrStrRev
Sorted IT, thanks for reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|