Delete

Top  Previous  Next

sub Delete(ByRef sSource As String, iStartPos As Integer, iLength As Integer)

 

Removes a substring of iLength characters from string sSource starting at position iStartPos. The first character of sSource has the index 1.

 

If iStartPos is larger than the length of the string or less than 1, no characters are deleted.

 

If iLength specifies more characters than remain starting at iStartPos, Delete removes the rest of the string. If iLength is less than or equal to 0, no characters are deleted.

 

Parameters

 

sSource ... String expression from which the substring is deleted.
iStartPos ... Integer expression. Starting position of the characters to delete. iStartPos is one based.
iLength ... Integer expression. Number of characters to delete.

 

Example:

Dim s

 

= "This is a text"

Delete(s, 6, 5)

' returns s = "This text"




Translate document: