Scripting Example 71

; *****************************************************

; Example71.ftp

; =============

; This example shows the use of "StringList" functions.

; "Stringlist" functions allow you to use a string variable

; to store a list of items, delimited with any character,

; like semicolon (;) or a comma (,) or any other for that

; matter...

;

; -----------------------------------------------------------

; functions demonstrated:

;

; Entry : Get an item from a list of strings

;

; NumEntries : Get number of items within a list of

; strings

;

; EntryIndex : Return the position of a particular

; item from a list of strings

;

; Syntax:

; Let A=Entry( <Itemlist>, <Position>, <Delimiter> )

; Let I=NumEntries( <Itemlist>, <Delimiter> )

; Let I=EntryIndex( <Itemlist>, <ItemToFind>, <Delimiter> )

;

; -----------------------------------------------------------

; NOTE: You are be able to execute this example unchanged.

; ***********************************************************

 

 

numvariable iNum

numvariable iIdx

 

let TheLine="List Item 1,List Item 2,List Item 3,List Item 4,List Item 5,List Item 6"

 

Let iNum=NumEntries( "%%Theline%%", "," )

Let A=Entry( "%%Theline%%", 2, "," )

Let iIdx=EntryIndex( "%%Theline%%", "List Item 4", "," )

 

message "The items in the list are %%iNum%% in total.//13//Second Item in list is: ''%%A%%''//13//Item called ''List Item 4'' is number %%iIdx%% in the list."