- 字符串方法
- 连接:String.Concat(str1,str2)
- 格式化:将对象的值转化为对应的字符串 String.Format("{0} is {1}",str1,str2)
- 联接:连接集合中的元素,返回字符串 String.Join("\\",Coll)
- 拆分:根据分隔符拆分字符串,返回集合 str.Split("\\"c)(index)
- 包含:检查字符串是否含有该字符 返回true或false str.Contains("aa")
- IndexOf: 返回索引,从零开始,第一次出现的字符 str.IndexOf("a")
- 替换: 用replaced替换original str.Replace("original","replaced")
- 截取字符串: str.Substring(startIndex,length)
- 列表方法
- 实例化:new List(of string) from {"ss","aa"} 或 new List(of String)
- 添加元素:使用Append Item to List活动添加元素
- 合并列表:用Assign活动接收Enumerable.Concat(SpainCities.AsEnumerable, UKCities.AsEnumerable).ToList。.AsEnumerable 用于将 2 个列表转换为可枚举数据类型,然后使用 .ToList 将结果转换为列表。
- 排序:使用VB的方法,使用活动Invoke Method对其排序,
- 我们使用“遍历循环”活动遍历“AllCities”变量中的元素,并:
- 使用 StrConv 方法将其转换为首字母大写:StrConv(item, VbStrConv.ProperCase);
- 使用Append Item to List将转换的项目添加到新创建的列表变量(“AllProperCase”).
- 我们使用“遍历循环”活动遍历“AllCities”变量中的元素,并:
- 字典(key,value)
- 实例化:new Dictionary (String, String)
- 填充值:使用活动Assign填充
- 删除:dictionary.Remove(Key) – 从字典删除项目。可以在“分配”活动中使用该方法。
- 检索:
- dictionary.Item(Key) – 按其键返回字典项目
- dictionary.Count – 返回字典项目数的 Int32 值
- dictionary.ContainsKey(Key) – 检查字典中是否存在具有给定键的项目并返回布尔结果
- dictionary.TryGetValue(Key, Value) – 检查字典中是否存在具有给定键的项目并返回布尔结果和值(如果找到)
- 正则表达式构建器
- 利用活动Matches设置正则表达式,可以使用Advanced自定义正则表达式
UiPath之数据操作(类型函数,字符串、列表、字典、正则表达式)
最新推荐文章于 2024-05-14 23:13:17 发布