| FUNCTION |
Extracts given item (substring) from comma-separated list of items.
item is a zero-based index of the item in the list (see also note below).
If no substring at given index is found then empty string is returned ("").
Useful to retrive symbols from the list obtained via GetCategorySymbols function.
New in AmiBroker version 5.20:
StrExtract( "string", item ) now accepts negative item values allowing to address items counting from the END of the list |
| EXAMPLE |
StrExtract( "MSFT,AAPL,AMD,INTC", 2 );//
will return AMD
StrExtract( "MSFT,AAPL,AMD,INTC", 0 );//
will return MSFT
StrExtract( "MSFT,AAPL,AMD,INTC", 200 );//
will return empty string ""
//
// The example below shows how to use negative item
// references (Version 5.20 AND up only!)
tickers = "AAPL,MSFT,INTC";
"The last item is " + StrExtract(
tickers, -1 );
printf("listing
from the end of the list:\n");
for( item = -1;
( sym = StrExtract( tickers,
item ) ) != ""; item--
)
{
printf( sym
+ "\n" );
} |