品牌:EA编程教程大全之字符函数
起订:1
供应:930
发货:1天内
string StringConcatenate( ...)
数据的字串符形式通过并且返回。 参量可以为任意类型。通过参量的总数不得超过64个字符。
 
作为应用到Print(), alert() 和Comment()函数的参量按照同样规则传送。从函数参量返回获取的字符串作为连接结果。
当字串符连续使用(+)添加时,StringConcatenate() 运行较快并且会存储。
参量:
...  -  所有价格值由逗号分开。 它可以是64个参量。 
 
示例:
  string text; 
  text=StringConcatenate( Account free margin is , AccountFreeMargin(), Current time is , TimeToStr(TimeCurrent())); 
// 文本= Account free margin is + AccountFreeMargin() + Current time is + TimeToStr(TimeCurrent()) 
  Print(text); 
 
 
 
 
int StringFind( string text, string matched_text, void start)
搜索子字串符。如果未找到子字串符,从搜索子字串符开始返回字串符中的位置,或是 -1。
参量:
text  -  被搜索的字符串。 
matched_text  -  需要搜索的字符串。 
start  -  搜索开始索引位置 。 
 
示例:
  string text= 快速的棕色小狗跨越过懒惰的狐狸  
  int index=StringFind(text, 小狗跨越 , 0); 
  if(index!=16) 
  Print( oops!  
 
 
 
 
int StringGetChar( string text, int pos)
从字串符指定位置返回代码。
参量:
text  -  字串符。 
pos  -  取字符的位置 。可以自0 至 StringLen(text)-1。 
 
示例:
  int char_code=StringGetChar( abcdefgh , 3); 
  // 取出代码 'c' 是 99 
 
 
 
 
int StringLen( string text)
在字串符中返回代码数。 Returns character count in a string.
参量:
text  -  计算字符串长度。
 
示例:
  string str= some text  
  if(StringLen(str) 5) return(0); 
 
 
 
 
string StringSetChar( string text, int pos, int value)
在指定位置返回带有改变代码的字串符复本。
参量:
text  -  改变的字串符代码。 
pos  -  字串符种代码的位置。可以自0 至 StringLen(text)。 
value  -  新取得ASCII 代码。
 
示例:
  string str= abcdefgh  
  string str1=StringSetChar(str, 3, 'D'); 
  // str1 is abcDefgh 
 
 
 
 
string StringSubstr( string text, int start, void length)
从给出的位置的文本字串符开端提取字串符。
如果可能此函数返回提取字串符的副本,否则返回空字串符。
参量:
text  -  将被提取的字串符。 
start  -  字串符开始索引。可以是自 0 至 StringLen(text)-1。 
length  -  字串符提取的宽度。如果参量值超过或等于 0 或者参量没有指定,字串符将被提取。 
 
示例:
  string text= 快速的棕色小狗跨越过懒惰的狐狸  
  string substr=StringSubstr(text, 4, 5); 
  // 减去字串符是 快速 单词 
 
 
 
 
string StringTrimLeft( string text)
在字串符左侧部分函数剪切空间和图表。如果可能函数返回一个剪切的复本。否则返回空字串符。
参量:
text  -  左侧剪切的字串符。 
 
示例:
  string str1=   Hello world   
  string str2=StringTrimLeft(str); 
  // 在剪切str2将是 Hello World   
 
 
 
 
string StringTrimRight( string text)
在字串符右侧部分函数剪切空间和图表。如果可能函数返回一个剪切的复本。否则返回空字串符。
参量:
text  -  右侧剪切的字串符。 
 
示例:
  string str1=   Hello world   
  string str2=StringTrimRight(str); 
  // 在剪切str2 之后将是   Hello World 
本文标签:

