|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function strSortTextList(strText As String)
' Procedure : strSortTextList
' Description: Sort the delimited text string.
' Copyright: Chris Greaves Inc.
' Inputs: String of text
' Returns: String, delimiter at RHS
' Assumes: First non-alphanumeric character is the list delimiter.
' Side Effects: None.
' Tested: By the calls shown below.
Dim intPos As Integer
Dim intStart As Integer
Dim strAr() As String
Dim strDelim As String
strDelim = ""
ReDim strAr(0)
intStart = 1
For intPos = intStart To Len(strText)
If Mid(strText, intPos, 1) Like "[a-z]" Then
Else
If Mid(strText, intPos, 1) Like "[A-Z]" Then
Else
If Mid(strText, intPos, 1) Like "[0-9]" Then
Else
If Mid(strText, intPos, 1) Like " " Then
Else
If strDelim = "" Then
strDelim = Mid(strText, intPos, 1)
Else
End If
'Procs Dim strItem As String
strAr(UBound(strAr)) = Trim(Mid(strText, intStart, intPos - intStart))
ReDim Preserve strAr(UBound(strAr) + 1)
intStart = intPos + 1
End If
End If
End If
End If
Next intPos
ReDim Preserve strAr(UBound(strAr) - 1)
Call QSort(strAr, 0, UBound(strAr), True)
Dim strResult As String
strResult = ""
Dim intAr As Integer
For intAr = 0 To UBound(strAr)
strResult = strResult & strAr(intAr) & strDelim
Next intAr
strSortTextList = strResult
'Sub TESTstrSortTextList()
'MsgBox strSortTextList("United Kingdom, France, Australia, Singapore.")
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |