VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "StringSet" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Option Explicit Dim StrgSet(1 To 26) As String 'a set of 26 strings indexed by A thru Z ' use GetString(letter) to fetch ' use PutString(letter,string) to set ' use Expand(string) to replace all shortcuts in string Private lShortCut As String * 1 Public Property Get ShortCut() As String ShortCut = lShortCut End Property Public Property Let ShortCut(ByVal NewShortCut As String) lShortCut = Left$(NewShortCut, 1) End Property Public Function GetString(c As String) As String Dim i As Integer i = Asc(UCase$(Left$(c, 1))) - Asc("A") + 1 GetString = StrgSet(i) End Function Public Function Expand(s As String) As String 'replace % shortcuts with real text} Dim OS As String Dim T As String Dim i As Long Dim c As String * 1 OS = "" 'initialize the output} For i = 1 To Len(s) 'scan through the string} If Mid$(s, i, 1) <> ShortCut Then OS = OS + Mid$(s, i, 1) 'if not shortcut mrker, pass through to output Else 'otherwise try to use letter to index into substitution strings} c = UCase$(Mid$(s, i + 1, 1)) 'ensure proper case} If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ", c) <> 0 Then 'ensure valid letter} T = GetString(c) 'substitute in the case of valid letter} Else T = "" 'no substitution for bad letter End If OS = OS + T i = i + 1 End If Next 'I Expand = OS End Function Public Sub PutString(IndexChar As String, Strg As String) Dim i As Integer i = Asc(UCase$(Left$(IndexChar, 1))) - Asc("A") + 1 StrgSet(i) = Strg End Sub Private Sub Class_Initialize() Dim i As Byte For i = 1 To 26 StrgSet(i) = "" 'initialize substitutable strings} Next 'I ShortCut = "%" End Sub