January 19, 2021, 04:44:59 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Algorithms
»
[bb] VB InstrRev() command by Jim Teeuwen [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] VB InstrRev() command by Jim Teeuwen [ 1+ years ago ] (Read 645 times)
BlitzBot
Jr. Member
Posts: 1
[bb] VB InstrRev() command by Jim Teeuwen [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:43 AM »
Title :
VB InstrRev() command
Author :
Jim Teeuwen
Posted :
1+ years ago
Description :
This one works just like the Instr() command, but it starts the search for the substring at the end of the sourcestring in stead of the front.
Handy for cutting off the filename from a complete systempath.
Code :
Code: BlitzBasic
;// Usage: InStrRev(String$, Substring$[, Start%])
;// String: The source in wich to look
;// Substring: The string for wich to look
;// Start(optional): The numeric position, counted from the left,
;// which defines where to start the search for the substring.
;// ### EXAMPLE ##################################
mystring$=InstrRev
(
"c:litz3Dlitz3d.exe"
,
""
,
1
)
print
"The filename is: "
+mystring$
;// output
The filename is: blitz3d.exe
;// ### THE GOODS ################################
Function
InstrRev$
(
sT$,sS$,index=
0
)
While
(
Instr
(
sT$,sS$
)
>
0
)
If
Instr
(
sT$,sS$
)
>
0
Then
sT$=
Mid
$
(
sT$,
Instr
(
sT$,sS$
)
+
1
)
EndIf
Wend
If
index=
0
Then
sT$=sS$+sT$
Return
sT$
End Function
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Algorithms
»
[bb] VB InstrRev() command by Jim Teeuwen [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal