非常简单的 TStrings的问题(30分)

P

pardboy

Unregistered / Unconfirmed
GUEST, unregistred user!
我要在一个TStrings中查找一个string 是否在其中???
该怎么做,要快。。。。。!!!!
 
自己看看帮助:
Locates the index for a string in a sorted list and indicates whether a string with that value already exists in the list.

function Find(const S: string
var Index: Integer
): Boolean
virtual;

Description

Use Find to obtain the index in a sorted list where the string S should be added. If the string S already exists in the list, Find returns True. If the list does not contain S, Find returns False. The index where S should go is returned in the Index parameter. The value of Index is zero-based, where the first string has the index 0, the second string has the index 1, and so on.

Note: Only use Find with sorted lists. For unsorted lists, use the IndexOf method instead.
 
if IndexOf()>=0 then
找到;
 
ComboBox1.Items没有find函数呀?
 
用Pos:pos('你的字符串',ComboBox1.Items.Text)>0在.
 
TYZhang的做法是最快的
 
TYZhang的做法比YNTW的做法要快吗?为什么呢??
 
如果Strings.items.indexof(String)=-1就没有,如果>0就有。
 
多人接受答案了。
 
顶部