Our Products
Classes
BMP
Crypto
CSVStrings
DataLogger
Dates
DebugRecorder
FileNameSet
FileSender
RDOConnectMaster
ReportAids
Sheller
StringSet
WEBUtilities
Modules
DAOLib
Globals
Registry
Programs
Batcher
HTMLGen
KillTime
TimedMessage
|
CSVStrings: Comma Separated Value (CSV, or Comma Delimeted) strings are an elegant and simple way of batching up small sets of information. So you can use them to move small lists of data around in an
application.
everything you need to implement them.
You can use any separator by setting the Delimeter property. So you can easily share files with spread sheet programs such as Lotus 1-2-3 or Excel.
Use AddString or PrefixString to add a string to the back or front of another string using the Delimeter as a separator. This means you can use them to implement either LIFO or FIFO lists of strings.
Boolean, Byte, Character, Double, Integer, Long, Single, and String values may be extracted, one at a time, from the front of a string. This makes it easy to take apart a CSV string into just the types needed.
To see sample use of CSVStrings and its full interface definition, scroll down. |
|
| This code segment illustrates some uses of the CSVStrings Class to construct and then tear down a CSV string. |
Dim csv as CSVStrings 'declare the object
Set csv = New CSVStrings 'initialize it
s = "" 'start out with an empty string
csv.Delimeter = "$" 'change delimeter to $
s = csv.AddString("Loves") 's = "Loves"
s = csv.PrefixString("Everybody") 's = "Everybody$Loves"
s = csv.AddString("Raymond") 's = "Everybody$Loves$Raymond"
w1 = csv.StringFrom(s) 'w1 = "Everybody";
's = "Loves$Raymond"
w2 = csv.StringFrom(s) 'w2 = "Loves"; s = "Raymond"
w3 = csv.StringFrom(s) 'w3 = "Raymond"; s is empty
Set csv = Nothing 'clean up memory
|
| Below is the full interface definition for the CSVStrings Class. |
Public Property Let Delimeter(ByVal NewDelimeter As String)
' Sets desired delimeter
Public Function ConditionApostrophes(strg As String) As String
' Changes embedded ' to ''
Public Function AddString(iString As String, aString As String) As String
' Returns iString,aString
' The default delimeter is "," which is changed via Delimeter property.
' If iString is initially empty, return is aString. aString may be
' enclosed in apostrophes (') or quotes (") to prevent embedded
' instances of Delimeter from breaking them up.
Public Function PrefixString(iString As String, aString As String) _
As String
' Returns aString,iString
' The default delimeter is "," which is changed via Delimeter propety.
' If iString is initially empty, return is aString. aString may be
' enclosed in apostrophes (') or quotes (") to prevent embedded
' instances of Delimeter from breaking them up.
Public Function BooleanFrom(d As String, Def As String) As Boolean
' Returns first field in d as a Boolean
Public Function ByteFrom(d As String) As Byte
' Returns first field of d as a Byte
Public Function CharFrom(d As String) As String
' Returns first field of d as a Char
Public Function DoubleFrom(d As String) As Double
' Returns first field of d as a Double
Public Function IntegerFrom(d As String) As Integer
' Returns first field of d as an Integer
Public Function LongFrom(d As String) As Long
' Returns first field of d as a Long
Public Function SingleFrom(d As String) As Single
' Returns first field of d as a Single
Public Function StringFrom(d As String) As String
' Returns first field of d as a String
|
|