Please enable JavaScript to view this site.

 

str = StrDelete(sString,nStart,nLength)

 

This macro function deletes characters from sString, starting at the position nStart for nLength characters.

 

You do not have to check if the values you are passing for nStart and nLength are too high; if they are, they will be ignored.

 

If nStart is larger than the length of sString, then the result will be the unmodified string sString.

If nStart+nLength-1 is larger than the length of sString, then the result will include of sString from 1 to nStart-1.

StrDelete('Hello',2,1) = 'Hllo'
StrDelete('Hello',2,3) = 'Ho'
StrDelete('Hello',2,4) = 'H'
StrDelete('Hello',2,1000) = 'H'
StrDelete('Hello',1000,3) = 'Hello' // no deletion

The functions StrDelete and StrCopy are complementary. What is deleted from a string using StrDelete, is what would have been copied with StrCopy, assuming the same parameters.

 

See also: StrCopy.

 


Topic 108276, last updated on 18-Apr-2020