Jørn Aakre was tasked to fix the entire project and brought it down from 2mb of source code to 80k and ~100% full-time CPU utilization to <1%. And, naturally, Jørn was paid a fair 200-400% less than the original consultants who developed it.
Public Function URLEncoder(strText)
Dim lngPlace As Long
Dim strBuffer As String
Dim strCharacter As String
Dim Buffer As String
Do While lngPlace < Len(strText)
lngPlace = lngPlace + 1
strCharacter = Mid(strText, lngPlace, 1)
Select Case strCharacter
Case Chr(0)
Buffer = Buffer & ""
Case Chr(1)
Buffer = Buffer & "%01"
Case Chr(2)
Buffer = Buffer & "%02"
Case Chr(3)
Buffer = Buffer & "%03"
Case Chr(4)
Buffer = Buffer & "%04"
Case Chr(5)
Buffer = Buffer & "%05"
Case Chr(6)
Buffer = Buffer & "%06"
Case Chr(7)
Buffer = Buffer & "%07"
Case Chr(8)
Buffer = Buffer & "%08"
Case Chr(9)
Buffer = Buffer & "%09"
Case Chr(10)
Buffer = Buffer & "%0A"
Case Chr(11)
Buffer = Buffer & "%0B"
Case Chr(12)
Buffer = Buffer & "%0C"
Case Chr(13)
Buffer = Buffer & "%0D"
Case Chr(14)
Buffer = Buffer & "%0E"
Case Chr(15)
Buffer = Buffer & "%0F"
Case Chr(16)
Buffer = Buffer & "%10"
Case Chr(17)
Buffer = Buffer & "%11"
Case Chr(18)
Buffer = Buffer & "%12"
Case Chr(19)
Buffer = Buffer & "%13"
Case Chr(20)
Buffer = Buffer & "%14"
Case Chr(21)
Buffer = Buffer & "%15"
Case Chr(22)
Buffer = Buffer & "%16"
Case Chr(23)
Buffer = Buffer & "%17"
Case Chr(24)
Buffer = Buffer & "%18"
Case Chr(25)
Buffer = Buffer & "%19"
Case Chr(26)
Buffer = Buffer & "%1A"
Case Chr(27)
Buffer = Buffer & "%1B"
Case Chr(28)
Buffer = Buffer & "%1C"
Case Chr(29)
Buffer = Buffer & "%1D"
Case Chr(30)
Buffer = Buffer & "%1E"
Case Chr(31)
Buffer = Buffer & "%1F"
Case Chr(32)
Buffer = Buffer & "+"
Case Chr(33)
Buffer = Buffer & "%21"
Case Chr(34)
Buffer = Buffer & "%22"
Case Chr(35)
Buffer = Buffer & "%23"
Case Chr(36)
Buffer = Buffer & "%24"
Case Chr(37)
Buffer = Buffer & "%25"
Case Chr(38)
Buffer = Buffer & "%26"
Case Chr(39)
Buffer = Buffer & "%27"
Case Chr(40)
Buffer = Buffer & "%28"
Case Chr(41)
Buffer = Buffer & "%29"
Case Chr(42)
Buffer = Buffer & "%2A"
Case Chr(43)
Buffer = Buffer & "%2B"
Case Chr(44)
Buffer = Buffer & "%2C"
Case Chr(45)
Buffer = Buffer & "%2D"
Case Chr(46)
Buffer = Buffer & "%2E"
Case Chr(47)
Buffer = Buffer & "%2F"
Case Chr(58)
Buffer = Buffer & "%3A"
Case Chr(59)
Buffer = Buffer & "%3B"
Case Chr(60)
Buffer = Buffer & "%3C"
Case Chr(61)
Buffer = Buffer & "%3D"
Case Chr(62)
Buffer = Buffer & "%3E"
Case Chr(63)
Buffer = Buffer & "%3F"
Case Chr(64)
Buffer = Buffer & "%40"
Case Chr(91)
Buffer = Buffer & "%5B"
Case Chr(92)
Buffer = Buffer & "%5C"
Case Chr(93)
Buffer = Buffer & "%5D"
Case Chr(94)
Buffer = Buffer & "%5E"
Case Chr(95)
Buffer = Buffer & "%5F"
Case Chr(96)
Buffer = Buffer & "%60"
Case Chr(123)
Buffer = Buffer & "%7B"
Case Chr(124)
Buffer = Buffer & "%7C"
Case Chr(125)
Buffer = Buffer & "%7D"
Case Chr(126)
Buffer = Buffer & "%7E"
Case Chr(127)
Buffer = Buffer & "%7F"
Case Chr(128)
Buffer = Buffer & "%80"
Case Chr(129)
Buffer = Buffer & "%81"
Case Chr(130)
Buffer = Buffer & "%82"
Case Chr(131)
Buffer = Buffer & "%83"
Case Chr(132)
Buffer = Buffer & "%84"
Case Chr(133)
Buffer = Buffer & "%85"
Case Chr(134)
Buffer = Buffer & "%86"
Case Chr(135)
Buffer = Buffer & "%87"
Case Chr(136)
Buffer = Buffer & "%88"
Case Chr(137)
Buffer = Buffer & "%89"
Case Chr(138)
Buffer = Buffer & "%8A"
Case Chr(139)
Buffer = Buffer & "%8B"
Case Chr(140)
Buffer = Buffer & "%8C"
Case Chr(141)
Buffer = Buffer & "%8D"
Case Chr(142)
Buffer = Buffer & "%8E"
Case Chr(143)
Buffer = Buffer & "%8F"
Case Chr(144)
Buffer = Buffer & "%90"
Case Chr(145)
Buffer = Buffer & "%91"
Case Chr(146)
Buffer = Buffer & "%92"
Case Chr(147)
Buffer = Buffer & "%93"
Case Chr(148)
Buffer = Buffer & "%94"
Case Chr(149)
Buffer = Buffer & "%95"
Case Chr(150)
Buffer = Buffer & "%96"
Case Chr(151)
Buffer = Buffer & "%97"
Case Chr(152)
Buffer = Buffer & "%98"
Case Chr(153)
Buffer = Buffer & "%99"
Case Chr(154)
Buffer = Buffer & "%9A"
Case Chr(155)
Buffer = Buffer & "%9B"
Case Chr(156)
Buffer = Buffer & "%9C"
Case Chr(157)
Buffer = Buffer & "%9D"
Case Chr(158)
Buffer = Buffer & "%9E"
Case Chr(159)
Buffer = Buffer & "%9F"
Case Chr(160)
Buffer = Buffer & "%A0"
Case Chr(161)
Buffer = Buffer & "%A1"
Case Chr(162)
Buffer = Buffer & "%A2"
Case Chr(163)
Buffer = Buffer & "%A3"
Case Chr(164)
Buffer = Buffer & "%A4"
Case Chr(165)
Buffer = Buffer & "%A5"
Case Chr(166)
Buffer = Buffer & "%A6"
Case Chr(167)
Buffer = Buffer & "%A7"
Case Chr(168)
Buffer = Buffer & "%A8"
Case Chr(169)
Buffer = Buffer & "%A9"
Case Chr(170)
Buffer = Buffer & "%AA"
Case Chr(171)
Buffer = Buffer & "%AB"
Case Chr(172)
Buffer = Buffer & "%AC"
Case Chr(173)
Buffer = Buffer & "%AD"
Case Chr(174)
Buffer = Buffer & "%AE"
Case Chr(175)
Buffer = Buffer & "%AF"
Case Chr(176)
Buffer = Buffer & "%B0"
Case Chr(177)
Buffer = Buffer & "%B1"
Case Chr(178)
Buffer = Buffer & "%B2"
Case Chr(179)
Buffer = Buffer & "%B3"
Case Chr(180)
Buffer = Buffer & "%B4"
Case Chr(181)
Buffer = Buffer & "%B5"
Case Chr(182)
Buffer = Buffer & "%B6"
Case Chr(183)
Buffer = Buffer & "%B7"
Case Chr(184)
Buffer = Buffer & "%B8"
Case Chr(185)
Buffer = Buffer & "%B9"
Case Chr(186)
Buffer = Buffer & "%BA"
Case Chr(187)
Buffer = Buffer & "%BB"
Case Chr(188)
Buffer = Buffer & "%BC"
Case Chr(189)
Buffer = Buffer & "%BD"
Case Chr(190)
Buffer = Buffer & "%BE"
Case Chr(191)
Buffer = Buffer & "%BF"
Case Chr(192)
Buffer = Buffer & "%C0"
Case Chr(193)
Buffer = Buffer & "%C1"
Case Chr(194)
Buffer = Buffer & "%C2"
Case Chr(195)
Buffer = Buffer & "%C3"
Case Chr(196)
Buffer = Buffer & "%C4"
Case Chr(197)
Buffer = Buffer & "%C5"
Case Chr(198)
Buffer = Buffer & "%C6"
Case Chr(199)
Buffer = Buffer & "%C7"
Case Chr(200)
Buffer = Buffer & "%C8"
Case Chr(201)
Buffer = Buffer & "%C9"
Case Chr(202)
Buffer = Buffer & "%CA"
Case Chr(203)
Buffer = Buffer & "%CB"
Case Chr(204)
Buffer = Buffer & "%CC"
Case Chr(205)
Buffer = Buffer & "%CD"
Case Chr(206)
Buffer = Buffer & "%CE"
Case Chr(207)
Buffer = Buffer & "%CF"
Case Chr(208)
Buffer = Buffer & "%D0"
Case Chr(209)
Buffer = Buffer & "%D1"
Case Chr(210)
Buffer = Buffer & "%D2"
Case Chr(211)
Buffer = Buffer & "%D3"
Case Chr(212)
Buffer = Buffer & "%D4"
Case Chr(213)
Buffer = Buffer & "%D5"
Case Chr(214)
Buffer = Buffer & "%D6"
Case Chr(215)
Buffer = Buffer & "%D7"
Case Chr(216)
Buffer = Buffer & "%D8"
Case Chr(217)
Buffer = Buffer & "%D9"
Case Chr(218)
Buffer = Buffer & "%DA"
Case Chr(219)
Buffer = Buffer & "%DB"
Case Chr(220)
Buffer = Buffer & "%DC"
Case Chr(221)
Buffer = Buffer & "%DD"
Case Chr(222)
Buffer = Buffer & "%DE"
Case Chr(223)
Buffer = Buffer & "%DF"
Case Chr(224)
Buffer = Buffer & "%E0"
Case Chr(225)
Buffer = Buffer & "%E1"
Case Chr(226)
Buffer = Buffer & "%E2"
Case Chr(227)
Buffer = Buffer & "%E3"
Case Chr(228)
Buffer = Buffer & "%E4"
Case Chr(229)
Buffer = Buffer & "%E5"
Case Chr(230)
Buffer = Buffer & "%E6"
Case Chr(231)
Buffer = Buffer & "%E7"
Case Chr(232)
Buffer = Buffer & "%E8"
Case Chr(233)
Buffer = Buffer & "%E9"
Case Chr(234)
Buffer = Buffer & "%EA"
Case Chr(235)
Buffer = Buffer & "%EB"
Case Chr(236)
Buffer = Buffer & "%EC"
Case Chr(237)
Buffer = Buffer & "%ED"
Case Chr(238)
Buffer = Buffer & "%EE"
Case Chr(239)
Buffer = Buffer & "%EF"
Case Chr(240)
Buffer = Buffer & "%F0"
Case Chr(241)
Buffer = Buffer & "%F1"
Case Chr(242)
Buffer = Buffer & "%F2"
Case Chr(243)
Buffer = Buffer & "%F3"
Case Chr(244)
Buffer = Buffer & "%F4"
Case Chr(245)
Buffer = Buffer & "%F5"
Case Chr(246)
Buffer = Buffer & "%F6"
Case Chr(247)
Buffer = Buffer & "%F7"
Case Chr(248)
Buffer = Buffer & "%F8"
Case Chr(249)
Buffer = Buffer & "%F9"
Case Chr(250)
Buffer = Buffer & "%FA"
Case Chr(251)
Buffer = Buffer & "%FB"
Case Chr(252)
Buffer = Buffer & "%FC"
Case Chr(253)
Buffer = Buffer & "%FD"
Case Chr(254)
Buffer = Buffer & "%FE"
Case Chr(255)
Buffer = Buffer & "%FF"
Case Else
Buffer = Buffer & strCharacter
End Select
Loop
URLEncoder = Buffer
End Function
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!