TGC Codebase Backup



Expanding the MID$ function a little by tlo

24th May 2005 20:18
Summary

People used to other basic languages maybe used to the 3 parameter MID$ function, well here it is. REM statements provide all the help you need



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM ****************************************************
REM Declare a function to emulate the 3 paramenter MID$
REM ****************************************************
function middle$(string$,startNo,LengthNo)

REM ****************************************************
REM string$  = the actual string to be sliced
REM startNo  = where you want the slice to start
REM LengthNo = how far you want the slice to go
REM ****************************************************

TheResult$=""

REM ****************************************************
REM Start a loop from where you want
REM for how long you want
REM ****************************************************

for f = startNo to startNo+LengthNo-1

REM ****************************************************
REM get each character of the string
REM ****************************************************

 TheResult$=TheResult$+MID$(string$,f)


REM ****************************************************
REM put each character into the answer
REM ****************************************************

next f

endfunction TheResult$