请问各位大虾,如何获取EDIT中的特定的某几个字符(50分)

  • 主题发起人 主题发起人 X-ary
  • 开始时间 开始时间
X

X-ary

Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位大虾,如何获取EDIT中的特定的某几个字符
例如
edit.text:=aaabbbccc;
如何使
edit2.text:=aaabb;
edit3.text:=bccc;
 
edit2.text:=Copy(edit.text,1,5);
edit3.text:=Copy(edit.text,6,4);
 
s1:=edit1.text;
i:=pos('aaabb',s1);
l:=length('aaabb');
edit2.text:=copy(s1,i,l);
edit2.text:=copy(s1,l+1,length(s1)-l));
看看pos,length,copy吧
 
edit2.text:=Copy(edit.text,1,5);
edit3.text:=Copy(edit.text,6,4);
看看帮助吧
copy function
Returns a substring of a string or a segment of a dynamic array.

Unit

System

Category

string handling routines

function Copy(S; Index, Count: Integer): string;
function Copy(S; Index, Count: Integer): array;

Description

S is an expression of a string or dynamic-array type. Index and Count are integer-type expressions. Copy returns a substring or sub array containing Count characters or elements starting at S[Index].

If Index is larger than the length of S, Copy returns an empty string or array.

If Count specifies more characters or array elements than are available, only the characters or elements from S[Index] to the end of S are returned.

Note: When S is a dynamic array, Copy can only be used as a parameter in a call to a procedure or function that expects an array parameter. That is, it acts like the Slice function when working with dynamic arrays.
 
谢谢各位的帮助,我的问题已经解决了。 :-)
 
后退
顶部