换行时字符串拆分 [英] String Split on Line Break

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

问题描述

我在 MS Access 表单上有一个文本框,用户要将一列数字从 Excel 电子表格复制到其中.我需要获取此输入并将其用作参数来构建查询.我有这样的代码

I have a textbox on a MS Access form that users are going to copy a column of numbers into from an excel spreadsheet. I need to take this input and use it as parameters to build a query. I have code that looks like this

Dim data as variant
Dim input as String
data = Split(input,vbLf)

我希望能够构建用户输入的列表,但我不知道如何在换行符处拆分它.我试过\n\r"、\n"."\r", vbCrLf, vbLf.输入看起来像12345[][]23456",每个数字之间有方框字符

I want to be able to build a list of the input from the users but I can't figure out how to split it on the line break. I've tried "\n\r", "\n". "\r", vbCrLf, vbLf. The input looks like "12345[][]23456" with the box characters between each number

谢谢

推荐答案

我使用 vbCrLf 让 Split 为我工作.我还将 Split 的结果写入了一个 String 数组.

I got Split to work for me using vbCrLf. I also wrote the result of Split to a String array.

这是我的代码:

Dim data() As String
Dim yourInput As String
data = Split(yourInput, vbCrLf)

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

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