VB6:用多个多字符分隔符分割?
我目前的 split 功能有问题。我可以仅用 1 个分隔符进行分割 (split()),也可以用许多单个字符进行分割 (custom())。有办法分割这个吗?请记住,这些分隔符是不按顺序排列的。
"MY!!DATA@@IS!!LOCATED@@HERE!!IN!!BETWEEN@@THE@@ATS!!AND!!MARKS"
我需要你的帮助才能得到以下结果,
"MY" , "DATA" , "IS" , "LOCATED" , "HERE" , "IN" , "BETWEEN","THE", "ATS" , "AND", "MARKS"
谢谢
I have a problem with the split function I have currently. I am able to either split with 1 delimited only (split()) or split with many single characters (custom()). Is there a way to split this? Keep in mind that these delimiters are not in order.
"MY!!DATA@@IS!!LOCATED@@HERE!!IN!!BETWEEN@@THE@@ATS!!AND!!MARKS"
I need your help to get the following result
"MY" , "DATA" , "IS" , "LOCATED" , "HERE" , "IN" , "BETWEEN","THE", "ATS" , "AND", "MARKS"
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建一个新的 VB6 EXE 项目并向您提供的表单中添加一个按钮,并对 Button1_Click 事件使用以下代码:
请注意,一旦第一个 For-Next 循环完成,[myArray] 将包含您的所有单词没有不需要的字符,因此您可以在任何您喜欢的地方使用它们。我只是将它们作为 MsgBox 显示给用户,以确保我的代码有效。
Create a new VB6 EXE project and add a button to the form you will be given, and use the following code for the Button1_Click event:
Notice that once the first For-Next loop is finished, the [myArray] will contain all of your words without the un-desired characters, so you can use them anywhere you like. I just displayed them as MsgBox to the user to make sure my code worked.
VB6 中的字符处理确实很尴尬。我更喜欢使用像这样的内置函数
使用
MultiSplit
像这样Character handling is really awkward in VB6. I would prefer using built-in functions like this
Use
MultiSplit
like this