美文网首页
字符函数

字符函数

作者: 牛在汇上飞 | 来源:发表于2018-10-23 12:00 被阅读0次

字符串函数

string StringConcatenate( 任意类型参 + ..... )

字串连接
(该函数比使用“+”连接字符串运行更快、更省内存。)
:: 输入参数
(参量可以为任意类型,总数不超过64个。)
... - 任意值,用逗号分割
示例:
string text;
text=StringConcatenate("Account free margin is ", AccountFreeMargin(), "Current time is ", TimeToStr(CurTime()));
// slow text="Account free margin is " + AccountFreeMargin() + "Current time is " + TimeToStr(CurTime())
Print(text);

int StringFind( string 原串, string 查词,void 始位=0)

找词位置
:: 输入参数
text - 被搜索的字符串
matched_text - 需要搜索的字符串
start - 搜索开始索引位置 (从左至右查找,如果未找到,返回-1 。)
示例:
string 文本="牛在天上飞";
int 位置= StringFind(文本, "牛在飞", 0);
Print("位置在:", 位置);
if( 位置==-1)
Print("未找到!");

int StringGetChar( string 原串, int 指定字位)

取字符串中某位置上的字符的ASCII值
:: 输入参数
text - 字符串
pos - 取字符的位置
示例:
int 码值= StringGetChar("牛在天上飞", 3);
Print(" 上 的码值是", 码值);

int StringLen( string 原串)

串长度
:: 输入参数
text - 字符串
示例:
int 串长= StringLen("牛在天上飞");

string StringSetChar( string 原串, int 指定位, int 新字符 )

在字符串中替换指定位置上的一个字符
:: 输入参数
text - 字符串
pos - 设置字符的位置 (范围从0至 StringLen(原串)-1)
value - 新的字符
示例:
string 原串= "My name is Pig";
string 新串= StringSetChar(原串, 12, 'D');
// 结果: 新串为 "My name is Dig"

string StringSubstr( string 原串, int 始位, in 长度=EMPTY)

从字串中截取子字串
:: 输入参数
text - 字符串
start - 开始索引位置(从左到右,包括空格与标点符)
count - 截取字符的数量
示例:
string 母串= "look, Bull is flying in the sky!";
string 子串= StringSubstr(母串 , 6, 14);
Comment(" 译者: ",子串);

string StringTrimLeft( string 原串)

删除字串左侧的空格
删除字符串左侧的回车符、空格和制表符。如果成功,函数将返回删除过的字符串,否则,返回空字符串。
:: 输入参数
text - 字符串
示例:
string str1=" Hello world !";
string str2=StringTrimLeft(str);
// after trimming the str2 variable will be "Hello World !"

string StringTrimRight( string 原串 )

删除字串右侧的空格
:: 输入参数
text - 字符串
示例:
string str1=" Hello world ";
string str2=StringTrimRight(str);
// after trimming the str2 variable will be " Hello World"

相关文章

  • PHP字符串处理函数

    字符串长度函数 字符串替换函数 截取字符串函数 分割、连接、反转函数 空白处理函数 字符转义函数 字符串比较函数

  • MySQL进阶之常用函数

    一.字符串函数 CONCAT 字符串拼接函数 LOWER 字符串小写函数 UPPER 字符串大写函数 LEFT(s...

  • Oracle中常用函数(SQL)

    Oracle函授有以下几个分类:数字函数、字符函数、日期函数、转换函数、集合函数、分析函数 数字函数: 字符函数:...

  • MySQL常见基本函数

    select 函数名(); 分类: 字符函数 数学函数 日期函数 一、字符函数 ps:注意英文符号 length:...

  • mysql函数汇总之字符串函数

    字符串函数主要用来处理数据库中的字符串数据。mysql中的字符串函数有计算字符串长度函数、字符串合并函数、字符串替...

  • 7.表的查询

    7.1 单行函数 7.1.1 字符函数 接收字符输入返回字符或者数值, ,dual 是伪表 7.1.2 数值函数 ...

  • PHP零基础入门

    字符函数库:函数库基础安装字符串函数库字符串函数库列表 函数是可以实现特定功能,可以重复执行的代码段。 函数分 内...

  • 字符串函数

    字符串转换类函数 addcslashes函数:以C语言风格使用反斜线转义字符串中的字符addslashes函数:使...

  • (七)运算符与函数

    1、字符函数 函数名称 | 描述----|------|----CONCAT() | 字符连接CONCAT_WS(...

  • MySQL基本使用

    函数 常用函数 数学函数 字符串函数 日期函数

网友评论

      本文标题:字符函数

      本文链接:https://www.haomeiwen.com/subject/zaetzftx.html