I'm working on VB6 code written by a Dutch speaker and maintained by an Italian (with variables and comments in those languages), with no indentation whatsoever.
Rather than use a string array, they repeatedly feed the same massive string literal into a Split function. This is done for every string resource the program uses.
For reasons beyond my understanding, there is this:
ikownjou = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[snip]" & Chr(1)
ikownjou = ikownjou & "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[snip]" & Chr(1)
There are 40 timers on the main form, all arranged in a grid. It looks like Flava Flav's coat of arms.
Rather than use different resource files for the 8 languages it's translated into, every time a form is loaded all 4 billion captions and menu items are set with a separate call to the 'locale("resource_name")' function which opens a file, looks for the entry for the current language, and closes the file.
Rather than use "Sub", they always use a "Function" with no return value that's peppered with about 70 "Exit Function" statements throughout its body.
All the non-static information is crammed in thousands of text files scattered across subfolders of subfolders, rather than in a database. Their version of "SELECT * FROM" is "DIR *.txt".
I replaced 4002 lines of this:
Public Function B64Length(ByVal TheString As String) As Integer
Select Case TheString
Case "@@"
B64Length = 0
Exit Function
Case "@A"
B64Length = 1
Exit Function
Case "@B"
B64Length = 2
Exit Function
Case "@C"
B64Length = 3
Exit Function
Case "@D"
B64Length = 4
Exit Function
----------[snip]------------
End Select
End Function
with two lines:
Private Const B64Compare = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}- €"
Public Function B64Length(ByVal strEncoded As String) As Integer
B64Length = (InStr(1, B64Compare, Left(strEncoded, 1)) - 1) * 64 + (InStr(1, B64Compare, Right(strEncoded, 1)) - 1)
End Function