TStringDynArray 动态数组  字符串 分解 分割  System::DynamicArray<System::UnicodeString>

TByteDynArray,    (TIdBytes)    String  相互转换  DynamicArray<System::Byte>

TIdBytes = array of Byte;

TByteDynArray;

Delphi   type TByteDynArray = array of Byte;

TByteDynArray defines a dynamic array of byte elements. You must use SetLength to allocate storage for such an array.

typedef DynamicArray<Byte>            TByteDynArray;
TBytes,就是 typedef System::DynamicArray<System::Byte> TBytes;

TBytes和TByteDynArray 是等价的。

数组

System::DynamicArray<int> array { 1, 2, 3, 4, 5};

DynamicArray<int> aint;
aint.Low;
aint.High;
aint[];
  1. arrayOfInt.Length = 10;
int total=;
for (int i=aint.Low; i<=aint.High; i++)
total += aint[i];
return total
SplitString 函数
#include <System.StrUtils.hpp>
TStringDynArray __fastcall SplitString(UnicodeString S, UnicodeString Delimiters);
和stringList的Delimiter一样,空格也分割了。

TByteArray 

#include <System.StrUtils.hpp>
#include <System.SysUtils.hpp>
 
TStringDynArray ls; 
ls = SplitString("a|b|c","|");
for(int i = ; i < ls .Length; i++)
ShowMessage(ls [i]);     TStringDynArray sarr;
    TStringList *ls = new TStringList();
    ls->Text = "a|b|c";
    sarr = ls->ToStringArray();
    delete ls; //String <==> TByteDynArray
String str;
str="abc";
    TByteDynArray barr;
    barr = str.BytesOf(); bytes=System::Sysutils::BytesOf(Caption);
bytes=System::Sysutils::WideBytesOf(Caption); Caption = System::Sysutils::StringOf(barr);
Caption = System::Sysutils::WideStringOf(barr);

TBytes bytes;

TByteDynArray barr;

String str;

str = Memo1->Text;

barr = str.BytesOf();

bytes = BytesOf(str);

bytes = WideBytesOf(str);

bytes = barr;

ExtractStrings

int __fastcall ExtractStrings(const System::Sysutils::TSysCharSet &Separators, const System::Sysutils::TSysCharSet &WhiteSpace, System::WideChar * Content, TStrings* Strings);

TStringDynArray  ar;  ar[0]=2;  ar[25]="";  ar.set_length(28);  ar[0]=2;  ar.Length;

用指定的字符串分割,空格可以不分割!

  ExtractStrings([';',',',':'],['#',' '],PChar(s),List);
  //第一个参数是分隔符; 第二个参数是开头被忽略的字符
  1. TStringDynArray arr;
  2. arr = System::Ioutils::TDirectory::GetFiles("C:\\Windows");
  3. this->Memo1->Lines->AddStrings(arr);
	TStringDynArray arr;
arr = System::Ioutils::TDirectory::GetFiles("C:\\Windows");
this->Memo1->Lines->AddStrings(arr);
  1. arr = System::Ioutils::TDirectory::GetFiles("c:\\windows","*.ppt", System::Ioutils::TSearchOption::soAllDirectories );
 for I := 0 to Length(LList) - 1 do
mmResults.Lines.Add(LList[I]);
 

Delphi 推荐用这个方法

astr:string;
  list: TArray<string>;
  list := astr.Split(['|']);
  list[0],list[1]...

for i := 0 to High(Editors) do

list[i]

for s in list

showmessage(s);

Split 是 delphi的函数,c++没有。TStringHelper = record helper for string

TStringList好用的特性
ss:TStringList;
begin
ss.AddPair('p1','aaaaa');
ss.AddPair('p2','bbbbb');
ss.Values['p1'];
ss.Values['p2'];

这样的效果

p1=aaaaa
p2=bbbbb

取p1的值aaaa

ss.Values['p1'];

st.Split([','],TStringSplitOptions.ExcludeEmpty);
CommaText甚是方便
TStrings.CommaText
aa
bb
cc
返回值 aa,bb,cc TStringList分割字符
新属性StrictDelimiter精确分割,空格不在分割换行了。         slsub->StrictDelimiter=true;
        slsub->Delimiter = awchar;
        slsub->DelimitedText = str; 拼接
list:TStringList;
Result := string.Join('|',List.ToStringArray) ;

XE4 TStringDynArray 比 c6 的TStringList 好用 字符串 分解 分割 转换 TByteDynArray的更多相关文章

  1. Delphi容器类之---TList、TStringList、TObjectList,以及一个例程的代码分析

    转载自:http://blog.csdn.net/jqandjq/article/details/5429137 看了这里标题,大家可能以为我会谈TListBox控件,那就错了.我要谈的是Delphi ...

  2. Python3 中bytes数据类型深入理解(ASCII码对照表)

    bytes的来源 bytes 是 Python 3.x 新增的类型,在 Python 2.x 中是不存在的. bytes 的意思是"字节",以字节为单位存储数据.而一个字节二进制为 ...

  3. Python-基础数据类型

    数据类型 计算机顾名思义就是可以做数学计算的机器,因此,计算机程序理所当然地可以处理各种数值.但是,计算机能处理的远不止数值,还可以处理文本.图形.音频.视频.网页等各种各样的数据,不同的数据,需要定 ...

  4. python字符串及其方法详解

    首先来一段字符串的基本操作 str1="my little pony" str2="friendship is magic" str3=str1+", ...

  5. Python3.x中bytes类型和str类型深入分析

    Python 3最重要的新特性之一是对字符串和二进制数据流做了明确的区分.文本总是Unicode,由str类型表示,二进制数据则由bytes类型表示.Python 3不会以任意隐式的方式混用str和b ...

  6. Delphi For Android 开发笔记 2 NEXTGEN下的字符串类型

    delphi开发速度迅捷至少有30%(猜的,呵呵)的原因是因为其字符串(string.WideString.PChar.PAnsiChar等)处理能力. 而从delphi XE4开始,在system等 ...

  7. delphi常用函数过程

    数据类型转化 1.1.         数值和字符串转化 Procedure Str(X [: Width [ : Decimals ]]; var S); 将数值X按照一定格式转化成字符串S.Wid ...

  8. python中unicode、utf8、gbk等编码问题

    转自:http://luchanghong.com/python/2012/07/06/python-encoding-with-unicode-and-gbk-and-utf8.html 概要:编码 ...

  9. strings

    3.1.1.1 计算列表中的字符串数目 使用Count属性可计算列表中的字符串数目.Count是只读属性,用以指示列表中字符串列表数目.因为字符串列表是以零开始索引,因而Count比列表的最大索引数大 ...

随机推荐

  1. 迭代器Iterator的底层实现原理

    第一步:没有接口的迭代器简单实现原理 package com.bjsxt.xiaofei; /** * 迭代器底层原理 * 方法: * hasNext() * next() * remove() * ...

  2. System.out.println()详解 和 HttpServletRequest 和 XMLHttpRequest

    System是一个类,位于java.lang这个包里面.out是这个System类的一个PrintStream类型静态属性.println()是这个静态属性out所属类PrintStream的方法. ...

  3. MySQL Transaction--事务隔离级别基础

    MYSQL 支持的事务隔离级别 REPEATABLE READ READ COMMITTED READ UNCOMMITTED SERIALIZABLE InnoDB 默认使用REPEATABLE R ...

  4. Linux下的Nginx、php、mysql、apache部署

    待补充,先搞几个博客链接: https://www.cnblogs.com/Candies/p/8282934.html http://sujianjob.com/2017/12/18/yum%E5% ...

  5. PHP 7.0 EOL (PHP 技术支持相关)

    PHP 7.0 EOL (PHP 支持相关) PHP 5.6 于 2018-12-31 结束(EOL) 从图表看出,PHP 7.0 是一个过渡版本,现在已经 EOL. 而 PHP 7.1 将于明年年底 ...

  6. Spring本质-AOP

    一.我们在做系统设计的时候,一个非常重要的工作就是把一个大系统做分解, 按业务功能分解成一个个低耦合.高内聚的模块,就像这样: 但是分解以后就会发现有些很有趣的东西, 这些东西是通用的,或者是跨越多个 ...

  7. python类的继承的两种方式

    class Animal(object): """docstring for Animal""" def __init__(self, na ...

  8. BeanUtils Object 取值赋值

    /** * 将结果集导出为Excel * * @param response * @param fsc * @param columns * @param bizType * @throws Exce ...

  9. 【shell】sed命令

    sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行为单位进行处理,可以将数据行进行替换.删除.新增.选取等特定工作,下面先了解一下sed的用法sed命令行格式为:         sed ...

  10. CXF运行wsdl2java :找不到系统路径

    已经配置好cxf的环境变量出现 解决方法:一定要设置JAVA_HOME这个变量