StrDelete$

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > String functions >

StrDelete$

 

Description

 

Delete a specified number of characters from a string expression.

 

Syntax

 

s = STRDELETE$(sMain, start, count)

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

sMain

String

No

Main string where to delete from

Start

Numeric

No

Position inside sMain where to start to delete

Count

Numeric

No

For how many chars to delete

 

Remarks

 

Restrictions

 

See also

 

String Handling,

 

Examples

 

Thanks to Abraxas for the following script example

Dim sMain      As String VALUE "HELLO WORLD"

Dim sNew       As String VALUE "TO THE "

Dim StringExpression As String VALUE sMain

Dim sDEL       As String

Dim sINS       As String

Dim sREV       As String

Dim sSTR       As String

Dim Start      As DWORD VALUE 4

Dim count      As DWORD VALUE 7

Dim position   As DWORD VALUE 7

Dim sMsg       As String

 

sDEL = STRDELETE$ (StringExpression , start, count)

sINS = STRINSERT$ (sMain, sNew, position)

sREV = STRREVERSE$(sMain)

 

sMsg += "sMain = " & sMain & $CRLF

sMsg += "sNew = " & sNew & $CRLF

sMsg += "StringExpression = " & StringExpression  & $CRLF & $CRLF

sMsg += "Start = " & Start & $CRLF

sMsg += "Count = " & count & $CRLF

sMsg += "Position = " & position & $CRLF & $CRLF

 

sMsg += "STRDELETE$(string_expression, start, count) = " & sDEL & $CRLF & $CRLF

sMsg += "STRINSERT$(sMain, sNew, position) = " & sINS & $CRLF & $CRLF

sMsg += "STRREVERSE$(sMain) = " & sREV & $CRLF & $CRLF

 

MSGBOX 0, sMsg