Post by hap2u on Mar 27, 2020 19:28:34 GMT -5
My apologies for disturbing the calm, I tend to go off the deep end when I am first using something.
Because I find it difficult to remember tons of terms I am against Command Bloat. You have a very simple Basic here and I am enjoying my experience to date. One way to keep Command Bloat to a minimum is to create Legacy Functions which show up when you click on the File/New menu. In the process of creating my translation program I had to create a Rtrim$ function. Until one is turned into a command it could be a legacy function, along with Ltrim$.
You could create the following command and turn the Left$, Right$, Mid$ and the replace one who's syntax I have forgotten into Legacy Functions.
Yes! I dislike the present string manipulators Microsoft stuck us with so I am biased. String$() Seems to work but I have only just started using it.
'________________________________________________________
function String$(Sp$,Sx,To$,Sy)
Err$="String$(Sp$,Sx,To$,Sy)"
IF OFFSUB=0 THEN
Ln=Ln+4: call logit Err$
print tab(Ln); Err$: Ln=Ln-4: OFFSUB=1
END IF
'1 Zero or Less returns 1 to number of Chr$ to left or right
'2 Zero or Less returns whole String or adds to start of string
'1 Greater than LEN of String returns number of Chr$ to right or left
'2 Greater than LEN of String returns Nul
'Sp$="123456": Sx=3: Sy=6: To$="90"
if Sx<0 then Sx=0: if Sy<0 then Sy=0
if Sy>len(Sp$) then Sy=len(Sp$)+1
if Sx>len(Sp$) then Sx=len(Sp$)+1
if Sx=0 and Sy=0 then Sy=Len(Sp$)
X1$="": X2$="": X$=""
if Sx<=Sy then
X$=mid$(Sp$,Sx,Sy-Sx+1)
X1$=Left$(Sp$,Sx-1)
X2$=mid$(Sp$,Sy+1)
else 'Sx>Sy
X$=mid$(Sp$,Sy,Sx-Sy+1)
X1$=Left$(Sp$,Sx)
X2$=mid$(Sp$,Sy)
end if
if len(To$)>0 then
Y$=To$+space$(len(To$))
Y$=left$(Y$,Len(To$))
X$=X1$+Y$+X2$
end if
String$=X$
end function
Because I find it difficult to remember tons of terms I am against Command Bloat. You have a very simple Basic here and I am enjoying my experience to date. One way to keep Command Bloat to a minimum is to create Legacy Functions which show up when you click on the File/New menu. In the process of creating my translation program I had to create a Rtrim$ function. Until one is turned into a command it could be a legacy function, along with Ltrim$.
You could create the following command and turn the Left$, Right$, Mid$ and the replace one who's syntax I have forgotten into Legacy Functions.
Yes! I dislike the present string manipulators Microsoft stuck us with so I am biased. String$() Seems to work but I have only just started using it.
'________________________________________________________
function String$(Sp$,Sx,To$,Sy)
Err$="String$(Sp$,Sx,To$,Sy)"
IF OFFSUB=0 THEN
Ln=Ln+4: call logit Err$
print tab(Ln); Err$: Ln=Ln-4: OFFSUB=1
END IF
'1 Zero or Less returns 1 to number of Chr$ to left or right
'2 Zero or Less returns whole String or adds to start of string
'1 Greater than LEN of String returns number of Chr$ to right or left
'2 Greater than LEN of String returns Nul
'Sp$="123456": Sx=3: Sy=6: To$="90"
if Sx<0 then Sx=0: if Sy<0 then Sy=0
if Sy>len(Sp$) then Sy=len(Sp$)+1
if Sx>len(Sp$) then Sx=len(Sp$)+1
if Sx=0 and Sy=0 then Sy=Len(Sp$)
X1$="": X2$="": X$=""
if Sx<=Sy then
X$=mid$(Sp$,Sx,Sy-Sx+1)
X1$=Left$(Sp$,Sx-1)
X2$=mid$(Sp$,Sy+1)
else 'Sx>Sy
X$=mid$(Sp$,Sy,Sx-Sy+1)
X1$=Left$(Sp$,Sx)
X2$=mid$(Sp$,Sy)
end if
if len(To$)>0 then
Y$=To$+space$(len(To$))
Y$=left$(Y$,Len(To$))
X$=X1$+Y$+X2$
end if
String$=X$
end function