Ooops
March 08, 2021, 04:37:01 PM
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] Delimeted string handler by Rob Farley [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] Delimeted string handler by Rob Farley [ 1+ years ago ] (Read 896 times)
BlitzBot
Jr. Member
Posts: 1
[bb] Delimeted string handler by Rob Farley [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:38 AM »
Title :
Delimeted string handler
Author :
Rob Farley
Posted :
1+ years ago
Description :
OK,
You've got a string with a few items in it and you want to find the 5th one. This function does it for you.
entry(5,"Mr,Mrs,Dr,Ms,Miss",",") will return "Miss"
Usage
Entry ( [element number], [list$] , [Delimeter$] )
Code :
Code: BlitzBasic
; Entry function by Rob Farley 2004
; rob@mentalillusion.co.uk
Function
Entry$
(
number,list$,delimeter$
)
n=
1
count =
1
found =
False
start =
1
If
number >
1
Repeat
If
Mid
(
list,n,
1
)
=delimeter
count = count +
1
If
count = number
found=
True
start = n +
1
Exit
EndIf
EndIf
n=n+
1
Until
n >=
Len
(
list
)
If
found =
False
Then
RuntimeError
(
"List Element out of Range"
)
EndIf
Endof =
Instr
(
list,delimeter,start
)
If
endof =
0
Then
endof =
Len
(
list
)
+
1
Return
Mid
(
list,start,endof-start
)
End Function
Comments :
Damien Sturdy(Posted 1+ years ago)
Neato function there
useful!
aab(Posted 1+ years ago)
excellent
_PJ_(Posted 1+ years ago)
Helped me out a lot! Cheers!
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Algorithms
»
[bb] Delimeted string handler by Rob Farley [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal