字符串的处理,往往是很多地方都要用到的。对于一个字符串,可以用以下方法来完成。
type userarray=array of string;
function tform1.split(s:string;dot:char):userarray;
var
str:userarray;
i,j:integer;
begin
i:=1;
j:=0;
SetLength(str, 255);
while Pos(dot, s) > 0 do
begin
str[j]:=copy(s,i,pos(dot,s)-i);
i:=pos(dot,s)+1;
s[i-1] := chr(ord(dot)+1);
j:=j+1;
end;
str[j]:=copy(s,i,strlen(pchar(s))-i+1);
result:=str;
end;
你可以改造一下,让它来达到你需要的结果。
在delphi把字符串分割成一维数组字符串的处理,往往是很多地方都要用到的。对于一个字符串,可以用以下方法来完成。 type userarray=array of string; function tform1.split(s:string;dot:char):userarray; var str:userarray; i,j...查看完整版>>
在delphi把字符串分割成一维数组
字符串分割扩展 SplitEx[Delphi]Didi.04-9-10 教师节function SplitEx(const Str {需要拆分的文章}, Delimiters {拆分关键字,回车.?!等}: string): TStringList;var ss: WideString; i, St: integer; function IsDelimiter(const Delimiters, c:...查看完整版>>
字符串分割扩展 SplitEx[Delphi]
一维指针遍历二维数组前日于清华编程技术版看到一个帖子,说谭浩强的书中有一段代码,不能通过编译,代码如下: main(){ int a[ 5 ][ 5 ], *p; p = a; *( *( p + 1 ) + 1 ) = 10;} 问题是显然的,一维指针被当成二维指针使用,本来...查看完整版>>
一维指针遍历二维数组
ABOUT:字符数组 很长一段时间内,PL/SQL开发人员必须有一个“index-by表”才能创建某个指定数据类型的或者PL/SQL记录的表。 因为他们只接受整型数据以从数组中提取数据,所以类型声明的末尾子句以“INDEX BY BINARY_INTEGER”...查看完整版>>
ABOUT:字符数组
从字符串中获得电子邮件数组'从字符串中获得电子邮件数组 Function GetMailListFromStrStream(ByVal StrStream As String) As ArrayList Dim Re As System.Text.RegularExpressions.Regex Dim RegStr As String = "[a-zA-Z0-9...查看完整版>>
从字符串中获得电子邮件数组