delphi学习 字符串切割问题(split)
最近做一个项目,要用Delphi,以前从未学过,好是费劲啊,哈哈光是字符串切割这个问题就困扰了几个小时,通过查资料终于解决,在这与大家分享一下
Function split(src: pchar; ch: char):TStringList;
// 分割字符串
var
i: Integer;
tmp : string;
begin
Result:=TStringList.Create;
tmp := '';
showmessage(src);
showmessage(inttostr(Length(src)));
for i := 0 to Length(src) do
begin
if src[i] <> ch then
begin
tmp := tmp + src[i];
end
else
begin
Result.Add(tmp);
tmp := '';
end;
end;
Result.Add(tmp);
end;
说明一下,有些人用Pos函数来对字符串分割,这个函数对中文处理不了,所以最好不要用,
调用方法
先定义一个 var AStrings: TStringList;
在下面使用时 AStrings:=TStringList.Create;然后AStrings:=FaClass.split(pchar(AStr),'|');就把分割后的数组保存在了AStrings中了
相关文档:
The built-in assembler allows you to write assembly code within Delphi programs. It has the following features:
内嵌的汇编器允许在delphi程序中书写汇编代码,他有如下特性:
Allows for inline assembly
允许内嵌汇编
Supports all instructions found in the Intel Pentium III, In ......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB,comobj, OleServer,
ExcelXP;
type
TForm1 = class(TForm)
ADOConn: TADOConnection;
& ......
2009-12-01 00:41:35
之前安装了oracle 10g,后来为了在C#里面连接oracle,安装了ODAC,之后连接数据库时,填写数据库服务名,总是会出错,连接测试无法通过,不填数据库服务名,倒还可以通过连接测试
今晚终于查到原因了。。。
系统属性那里的环境变量,path这里,oracle的两个默认路径:
d:\oracle\product\10. ......
http://www.delphibbs.com/delphibbs/dispq.asp?lid=2420610
目录
===============================================================================
⊙
RTTI 简介
⊙ 类(class) 和 VMT 的关系
⊙ 类(class)、类的类(class of class)、类变量(class
variable) 的关系
⊙ TObject.ClassType 和 TObject.ClassInf ......
1、当然是先要卸载以前安装的Ehlib组件了,在菜单的“Component”的“install Packeges”里,选择ehlib XX,选择“Remove”。
2、接下来在库里加入这个控件的引用路径,先新建一个文件夹,比如“D:\Component\Ehlib”(最好把要安装的控件都拷贝到这个Component目录下),然后把 ......