Code archives/File Utilities/Simple way to separete/cut a string
This code has not been declared by its author to be Public Domain code, and therefore should not be assumed to be so.
Download source code
| I use this little function to load my map files that are stored on a simple text file. You can store some stuff like this : "info1/info2/info3/" |
Cuts the string and gets only the info you want Ex: If CString$ is "abc/def/" and CNumber if 2, then the function will return "def". * DO NOT FORGET TO INCLUDE A "/" IN THE END OF THE STRING * This little function was made by Insane Games (david@infomaniacos.org). If you know how to make it goes faster or how to avoid the use of the last "/", please, send me an email. Thanx. Function CutString$(CString$, CNumber) stemp$ = "" numtemp = 0 For temp=1 To Len(CString$) If Mid(CString$, temp, 1)<>"/" stemp$ = stemp$ + Mid(CString$, temp, 1) Else numtemp = numtemp + 1 If numtemp = CNumber Return stemp$ Else stemp$ = "" EndIf EndIf Next Return "" End Function ;Print CutString$("abc/def/", 2) ;- just for testing |