AutoIt拆分字符串 [英] AutoIt Split String

查看:159
本文介绍了AutoIt拆分字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像这样的字符串:

I have a String like this:

Info1|Info2

我希望此字符串由|分隔.并且它应该返回第二个Info和第一个Info. 所以我想要一个显示Info1的msgbox和另一个显示Info2的msgbox. 我怎样才能做到这一点? 我已经尝试过

I want this String to be splitted by | and a it should return the second Info and the first one. So I want one msgbox displaying Info1 and another one displaying Info2. How can I do this? I already tried

StringSplit

StringSplit

但没有成功...

推荐答案

尝试一下:

#Region    ;************ Includes ************
#Include <Array.au3>
#EndRegion ;************ Includes ************
$str = 'Info1|Info2'
$array = StringSplit($str, '|', 2)
For $i = 0 To UBound($array) - 1
    MsgBox(64, $i, $array[$i], 1)
Next
_ArrayDisplay($array) ; example

这篇关于AutoIt拆分字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆