通过实例学习Virtools脚本语言VSL - 从数组读取字符串
2009-08-01 20:41
609 查看
该系统演示了怎样用VSL从数组读取字符串,它是习题4的逆过程。
开始,创建一个数组,进入"Array Setup"面板对它进行编辑。
根据你的喜欢穿件一些列(Column),并创建几行。
现在再在每个单元格中填充一些文本。
你的数组可能会像下面这个样子:
![](https://sites.google.com/site/x3dofcn/_/rsrc/1245510842861/vsl-virtools/Examples/6_stringarray/example6.jpg)
在层级(Level)下创建一个脚本,并添加一个Run VSL BB。在VSL Script Manager工作区中,为该BB添加一个名为的"myarray"的pIn参数,类型为"Array"。编辑该参数,并将它设置给你的数组。
现在可以去看看Virtools Minisite
中提供更多的VSL技术性样例,位置在Dev的文档文件夹下 /CMOS/TechnicalSamples/VSL/Samples/.。
开始,创建一个数组,进入"Array Setup"面板对它进行编辑。
根据你的喜欢穿件一些列(Column),并创建几行。
现在再在每个单元格中填充一些文本。
你的数组可能会像下面这个样子:
![](https://sites.google.com/site/x3dofcn/_/rsrc/1245510842861/vsl-virtools/Examples/6_stringarray/example6.jpg)
在层级(Level)下创建一个脚本,并添加一个Run VSL BB。在VSL Script Manager工作区中,为该BB添加一个名为的"myarray"的pIn参数,类型为"Array"。编辑该参数,并将它设置给你的数组。
void main() { // Array where we will put the strings that will be read. ArrayString arrayString; // String as temporary buffer. String tmp; // Loop to read each array's cell. for (int c = 0; c < myarray.GetColumnCount(); ++c) { for (int r = 0; r < myarray.GetRowCount(); ++r) { // First we get the size of the string at pos (r, c) // (zero included) int lengthToRead = myarray.GetElementStringValue(r, c, null); // Then we resize the string before reading the array. tmp.Resize(lengthToRead-1); // At last, we can read the string. // Note that 3rd parameter of GetElementStringValue is a str // and not an String. myarray.GetElementStringValue(r, c, tmp.Str()); // We keep the read string in our array. arrayString.PushBack(tmp); } } // We can do what we want with these strings. int stringNb = arrayString.Size(); for (int i = 0; i < stringNb; ++i) { bc.OutputToConsole(arrayString[i].Str()); } }
现在可以去看看Virtools Minisite
中提供更多的VSL技术性样例,位置在Dev的文档文件夹下 /CMOS/TechnicalSamples/VSL/Samples/.。
相关文章推荐
- 通过实例学习Virtools脚本语言VSL - 从数组读取字符串
- 通过实例学习Virtools脚本语言VSL - 解析字符串
- 通过实例学习Virtools脚本语言VSL - 检索和修改数组的数据
- 通过实例学习Virtools脚本语言VSL - 合并字符串
- 通过实例学习Virtools脚本语言VSL - 合并字符串
- 通过实例学习Virtools脚本语言VSL - 解析字符串
- 通过实例学习Virtools脚本语言VSL - 检索和修改数组的数据
- 通过实例学习Virtools脚本语言VSL - 解二次方程
- 通过实例学习Virtools脚本语言VSL - 将物体排列于圆周上
- 通过实例学习Virtools脚本语言VSL - 解二次方程
- 通过实例学习Virtools脚本语言VSL - 将物体排列于圆周上
- 通过对PHP语言的学习,应该知道它是基于函数的一款HTML脚本语言。庞大的函数库支持着PHP语言功能的实现。下面我们为大家介绍有关PHP函数isset()与empty()的相关用法。
- Virtools脚本语言(VSL)教程 - 使用 GUID
- C语言学习5-1:字符加法,字符串操作函数编写,查找数组中第二大的数
- Virtools脚本语言(VSL)介绍
- Scala学习笔记(二)--数组、列表、元祖和scala脚本编写及读取文件
- C语言学习之 数组,指针,字符串. (三)
- C_PlusPlus学习笔记 - 5_数组、指针和字符串 (C++语言程序设计【第三版】 郑莉等,清华大学出版社)
- go语言学习----字符串、数组和切片的应用
- Virtools脚本语言(VSL)教程 - 使用 GUID