Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Return the portion of a string leading up to the first occurrence of a specified character or string.

 

Syntax

 

s = EXTRACT$([Start,] MainString, [ANY] MatchString [, CaseSensitive])

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

Start

Number

Yes

Optional starting position in MainString

MainString

String

No

String to search in

MatchString

String

No

String to search for.

CaseSensitive

Number

Yes

Optional parameter used to indicate if match must be case sensitive or not.

Use %TRUE or %FALSE. Default value is %TRUE

 

Remarks

 

If the ANY keyword is specified, MatchString specifies a list of single characters to be searched for individually.

 

Restrictions

 

See also

 

String Handling,

 

Examples

 

Script example

' FirstItem = first command-line argument, assuming

' spaces, commas, periods, and tabs are valid delimiters

FirstItem = EXTRACT$(COMMAND$ANY " ,." CHR$(9))

 

Thanks to Michael Clease for the following script example

' Usage of the EXTRACT$ Keyword example'

' Written by Michael Clease

 

Dim sMainString    As String Value "The quick brown fox jumped over the lazy dogs"

Dim sMatchString   As String Value "over"

Dim sExtractString As String

DIM Start          as DWORD VALUE 4

DIM sMsg           as string

 

sExtractString = Extract$(Start,sMainString,  sMatchString)

 

sMsg  = "sMainString    = " & sMainString    & $CRLF

sMsg += "sMatchString   = " & sMatchString   & $CRLF

sMsg += "sExtractString = " & sExtractString & $CRLF & $CRLF

 

MsgBox 0, sMsg

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software