Contents - Index


DELETE$

 

DELETE$ requires 3 parameters  The first parameter is a string constant or string variable.    The second argument indicates the character position in the string at which to start deleting characters.  The third parameter is number of characters to delete.  If this length exceeds the length of the string expression, it is set to the length of the string expression.  

 

Example 1: 

F$='I can not do this'

G$=DELETE$(F$,7,4)

{Solution:

F$='I can not do this'

G$='I can do this'

}

 

Example 2: {removes all spaces from a string}

Function deletespaces$(F$)

   Repeat

       p=stringpos(' ',F$)

       If (p>0) Then F$=delete$(F$,p,1)

   Until (p=0)

   deletespaces$=F$

End

A$='0.95 CH4 + 0.05 C2H6'

B$=deletespaces$(A$)

{Solution:

A$='0.95 CH4 + 0.05 C2H6'

B$='0.95CH4+0.05C2H6'

}

 

Return to String Functions