MID$ Function (New Features)

by lrcvs, Sunday, September 30, 2012, 17:43 (1846 days ago)

#This program writes a text in a specific position on a string pattern.
#This is the MID$ "Statement" when acts like a statement in QBasic.

# Mid( string master, start ) = text
# Mid( string master, start, length of text) = text


#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
#string master
a$ = "......................................................."

c = length (a$)

dim z$(c + 1 )

#write string master into array
for k = 1 to c
z$[k] = mid (a$,k,1)
next k

#reinit program
reinicio:
y$ = ""

#string test to write into array
input "Text to write: " , b$
input "Position 1... ", p

d = length (b$)
if p > c then p = c - d
cls

#write string into array
for j = 1 to d
z$[p+(j-1)] = mid (b$,j,1)
next j

#show string master
for n = 0 to c
y$ = y$ + z$[n]
next n
print y$

goto reinicio


Complete thread:

 RSS Feed of thread

powered by my little forum