Hello everybody,
I am trying to create a Text encoder - decoder using the rail fence technique.
But I get a runtime error when I try to decode the text.
I can 't seem to find the problem.
Can anybody help me?
here is the code.
Private Function decode2(ByVal strCode As String, ByVal key As String) As String
Dim i As Integer
Dim j As Integer
Dim intHulp As Integer
decode2 = Space(Len(strCode))
intHulp = 1
For i = 0 To key - 1
For j = 1 To Len(strCode) Step key
Mid(decode2, i + j, 1) = Mid(strCode, intHulp, 1)
intHulp = intHulp + 1
Next j
Next i
end function
thanx for replying.
I am trying to create a Text encoder - decoder using the rail fence technique.
But I get a runtime error when I try to decode the text.
I can 't seem to find the problem.
Can anybody help me?
here is the code.
Private Function decode2(ByVal strCode As String, ByVal key As String) As String
Dim i As Integer
Dim j As Integer
Dim intHulp As Integer
decode2 = Space(Len(strCode))
intHulp = 1
For i = 0 To key - 1
For j = 1 To Len(strCode) Step key
Mid(decode2, i + j, 1) = Mid(strCode, intHulp, 1)
intHulp = intHulp + 1
Next j
Next i
end function
thanx for replying.