Executive,
I do not understand you, Larry gave you an answer, I completed it something
more and than you come with a solution that is completly different, why you
ask here in this newsgroup for help?
This could have been the solution as Larry and I suggested to you.
\\\
Public Class main
Public Shared Sub main()
Dim String1 As String = "The quick brown fox % jumped over the dog."
Dim String2 As String = "The quick %1 fox %% jumped over the %2."
Dim String3 As String = "Yo %% momma's %1 beaver smells like %2."
Dim a As String() = String1.Split(" "c)
Dim b As String() = String2.Split(" "c)
If a.Length <> b.Length Then
MessageBox.Show("Impossible to do")
Exit Sub
End If
Dim hs As New Hashtable
For i As Integer = 0 To a.Length - 1
If b(i).IndexOf("%") <> -1 Then
hs.Add(b(i), a(i))
End If
Next
Dim c As String() = String3.Split(" "c)
For i As Integer = 0 To c.Length - 1
If c(i).IndexOf("%") <> -1 Then
If hs.ContainsKey(c(i)) Then
c(i) = hs.Item(c(i)).tostring
End If
End If
Next
MessageBox.Show(Join(c))
End Sub
End Class
///
Very simple, however when you ask next time, than tell why the answer does
not fits you or what you do not understand instead of completly ignoring
them.
I hope this helps something?
Cor
"exekutive" <(E-Mail Removed)>
...
> Wow thats a lot of response. Thank you thank you. I'll have to digest
> this
> for a while. In the meantime, here's what I wrote ... the Mask function
> isn't finished obviously, but the FindDelimiters function successfully
> returns an integer array of the postions of %x tokens within the inStr
>
>
Code:
> Public Function Mask(ByRef inputStr As String, ByRef maskInStr As
> String, ByRef maskOutStr As String, ByVal delimiter As Char) As String
>
> Dim outputStr As String
> Dim delimiterIndexes As Integer()
>
> delimiterIndexes = FindDelimiters(maskInStr, delimiter)
>
> Return outputStr
>
> End Function
>
> Public Function FindDelimiters(ByRef inStr As String, ByVal d As Char)
> As Integer()
>
>
> Dim tempIndex As Integer = -2
> Dim delimiterCounter As Integer
>
> ' Count the instances of 'd' in 'inStr'
> Do
> tempIndex = inStr.IndexOf(d, tempIndex + 2)
> If tempIndex <> -1 Then delimiterCounter += 1
> Loop Until tempIndex = -1
>
> ' Set the bounds of an array to the number of instances of 'd'
> Dim indexDelimiters(delimiterCounter - 1) As Integer
>
> ' Fill the array with the positions of 'd' in 'inStr'
> For tempIndex = 0 To delimiterCounter - 1
> If tempIndex = 0 Then
> indexDelimiters(tempIndex) = inStr.IndexOf(d, 0)
> Else
> indexDelimiters(tempIndex) = inStr.IndexOf(d,
> indexDelimiters(tempIndex - 1) + 2)
> End If
> Next
>
> Return indexDelimiters
>
> End Function
>
>