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)
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
Thanks
Split String by Newline in Java 8. Java 8 provides an “\R” pattern that matches any Unicode line-break sequence and covers all the newline characters for different operating systems. Therefore, we can use the “\R” pattern instead of “\\r?\\ n|\\r” in Java 8 or higher.
It means that your line is a String of numbers separated by commas. eg: "12.34,45.0,67.1" The line. split(",") returns an array of Strings.
To split the line in Python, use the String split() method. The split() is an inbuilt method that returns a list of lines after breaking the given string by the specified separator.
I got Split to work for me using vbCrLf. I also wrote the result of Split to a String array.
Here's my code:
Dim data() As String
Dim yourInput As String
data = Split(yourInput, vbCrLf)
vbCRLF worked for me, try: Strings.Chr(13) & Strings.Chr(10) (which is vbCRLF)
try to see what is the ASCII code of those 2 boxes:
//ex for input = "12345[][]23456"
Strings.Asc(Strings.Mid(input, 6, 1))
Strings.Asc(Strings.Mid(input, 7, 1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With