Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6887741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:55:18+00:00 2026-05-27T05:55:18+00:00

I’m attempting to load text files in to a database line by line, I

  • 0

I’m attempting to load text files in to a database line by line, I cannot use a standard import method as the breakdown of the file means that each line has a different number of columns, however it is thankfully comma separated.

I’m attempting to use the ‘Split’ function so that I may extract certain information from each line, unfortunately any text fields are ” ” enclosed and some will contain comma’s within the specified text.

Is it possible to use the Split function and ignore any comma’s that fall within enclosed text, if not then I’m happy to write a custom function but is it possible to determine if a text string is enclosed by ” ” ?

Thanks & Kind Regards,

Matt.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:55:19+00:00Added an answer on May 27, 2026 at 5:55 am

    Many thanks mwolfem I’m sorry to say I haven’t tested your code yet but in my case I’m looking to pick certain values from my string without printing the whole line, however after a little more research I have a working solution for anyone else who is struggling with this problem, is as follows:

    Create this first function in a module:

    Public Function DelimConvertor(varInput As Variant, strDelim As String, strQualifier As String) As Variant
    
    Const strStart = "Ã" 'Ascii 195, or any other Ascii you are unlikely to encounter
    Const strEnd = "ž" 'Ascii 158, or any other Ascii you are unlikely to encounter
    Const strNewDelim = "§" 'Ascii 167, or any other Ascii you are unlikely to encounter
    
    Dim lngi        As Long
    Dim strChar     As String
    Dim flgStart    As Boolean
    Dim varOutput   As Variant
    
    'Format the string so we can distinguish the fields
    
    If Left(varInput, 1) = strQualifier Then
    varInput = strStart & Right(varInput, Len(varInput) - 1)
    End If
    
    If Right(varInput, 1) = strQualifier Then
    varInput = Left(varInput, Len(varInput) - 1) & strEnd 
    End If
    
    varInput = Replace(varInput, strDelim & strQualifier, strDelim & strStart)
    
    varInput = Replace(varInput, strQualifier & strDelim, strEnd & strDelim)
    
    'Loop through and format the rest of the string
    
    For lngi = 1 To Len(varInput)
    
    strChar = Mid(varInput, lngi, 1)
    
    Select Case strChar
    
    Case strStart
    
    flgStart = True
    
    Case strEnd
    
    flgStart = False
    
    Case Else
    
    If flgStart Then
    
    varOutput = varOutput & strChar
    
    ElseIf strChar = strDelim Then
    
    varOutput = varOutput & strNewDelim
    
    Else
    
    varOutput = varOutput & strChar
    
    End If
    
    End Select
    
    Next
    
    'Return the cleansed stream that can now be used with the Split function
    
    DelimConvertor = varOutput
    
    End Function
    

    And you then then use it during a file import with something like the following:

    Public Function Test()
    
    Dim fso         As New FileSystemObject
    Dim ts          As TextStream
    Dim strArray()  As String
    
    Set ts = fso.OpenTextFile("C:\Users\Admin\Desktop\test.txt", ForReading)
    
    strArray = Split(DelimConvertor(ts.ReadLine, ",", """"), "§")
    
    'Obtain your desired field here e.g. strArray(0)
    
    ts.Close
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a reasonable size flat file database of text documents mostly saved in
I want use html5's new tag to play a wav file (currently only supported
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.