惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
爱范儿
爱范儿
Y
Y Combinator Blog
T
Tor Project blog
V
Visual Studio Blog
U
Unit 42
B
Blog RSS Feed
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
G
Google Developers Blog
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog
T
The Blog of Author Tim Ferriss
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
博客园_首页
罗磊的独立博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
P
Proofpoint News Feed
Jina AI
Jina AI
博客园 - 【当耐特】
S
Security @ Cisco Blogs
I
Intezer
MyScale Blog
MyScale Blog
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
腾讯CDC
T
Tenable Blog
A
Arctic Wolf
T
Threat Research - Cisco Blogs
S
Securelist
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
C
Check Point Blog
NISL@THU
NISL@THU
Microsoft Security Blog
Microsoft Security Blog
V
Vulnerabilities – Threatpost

博客园 - IMustDo

Delphi TWebBrowser编程简述(转帖) delphi 如何将XML格式的字符串导入ClientDataSet中 用WebBrowser实现HTML界面的应用 delphi TStringList的用法 使用VSS 的Shadow folder的一点问题 delphi 最快速编码 URLDecode URLEncode Delphi 2007 如何安装控件 Javascript+xmlhttp调用Webservice以及注意事项 .NET 3.5和VS 2008中的ASP.NET AJAX(转帖) VS.net 2008 beta2 新功能 VS 2008 和 .NET 3.5 Beta 2 发布了(转帖) .Net平台开发的技术规范与实践精华总结(转载收藏) 35 岁前程序员要规划好的四件事(转载) ASP.NET程序中常用的三十三种代码(转载) 40种网站设计常用技巧(转载) Visual C#常用函数和方法集汇总(收藏) 访问母版页上的成员 用缓存吧,反正现在内存白菜价,不用白不用。 在MasterPage中使用javascript获取对象
Delphi 字符串操作
IMustDo · 2007-10-18 · via 博客园 - IMustDo

这几个函数都包含在StrUtils中,所以需要uses StrUtils; 
假设字符串是 Dstr := ’Delphi is the BEST’, 那么 
LeftStr(Dstr, 5) := ’Delph’ 
MidStr(Dstr, 6, 7) := ’i is th’ 
RightStr(Dstr, 6) := ’e BEST’ 

~~~~~~~~~~~~~~~~~~~~~~~~~ 
function RightStr 
    (Const Str: String; Size: Word): String; 
begin 
  if Size > Length(Str) then Size := Length(Str) ; 
  RightStr := Copy(Str, Length(Str)-Size+1, Size) 
end; 
function MidStr 
    (Const Str: String; From, Size: Word): String; 
begin 
  MidStr := Copy(Str, From, Size) 
end; 
function LeftStr 
    (Const Str: String; Size: Word): String; 
begin 
  LeftStr := Copy(Str, 1, Size) 
end; 

这几个函数经常结合Pos, Length, Copy使用

拆分字符串的函数  [2005-12-13]
  
delphi中没有提供此类函数,从大富翁找了一个

function split(src,dec : string):TStringList;
var
  i : integer;
  str : string;
begin
  result := TStringList.Create;
  repeat
    i := pos(dec,src);
    str := copy(src,1,i-1);
    if (str='') and (i>0) then
    begin
      delete(src,1,length(dec));
      continue;
    end;
    if i>0 then
    begin
      result.Add(str);
      delete(src,1,i+length(dec)-1);
    end;
  until i<=0;
  if src<>'' then
    result.Add(src);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  ss : TStringList;
  str,dec : string;
begin
  str := '1111||2222||||3333|||4444||';
  dec := '||';
  ss := split(str,dec);
  memo1.Lines.AddStrings(ss);
  ss.Free;
end;