下面的示例创建一个数组,并用公司名给每个元素赋值。然后使用
ascan( ) 函数搜索特定的公司名。如果在数组中找到这个公司名,将其从数组中删除。
close databases
open database (home( ) + 'samples\data\testdata')
use customer && 打开表 customer
select company from customer ;
where country = 'uk' ;
into array gacompanies
gncount = _tally
gcname = 'seven seas imports'
clear
display memory like gacompanies*
gnpos = ascan(gacompanies, gcname) && 搜索公司名
if gnpos != 0
*** 如果找到此公司名,将其从数组删除 ***
= adel(gacompanies, gnpos)
gncount = gncount - 1
endif
display memory like gacompanies