View Sidebar

A Million Little Pieces Of My Mind

Organica Core: Utilities Module

By: Paul S. Cilwa Viewed: 3/3/2024
Posted: 8/14/2018
Page Views: 704
Topics: #Computers #Projects #Organica
A place for oddball helper procedures and functions.

Any project needs a general module for random, code-saving utility functions. We're going to create such a module in this chapter and put a couple of starter procedures into it.

Call the module Utils.vb and enter the following two procedures.

Utils.vb (new)

Module Utils Public Sub ConCat(ByRef Buffer As String, ByVal AddThis As String) Buffer = Buffer & AddThis End Sub Public Function HTML_Encode(ByVal Value As String) As String Value = Value.Replace("--", "—") Value = Value.Replace("—", "—") Value = Value.Replace(Chr(150), "—") Value = Value.Replace("é", "é") Value = Value.Replace("""", """) Value = Value.Replace(ChrW(8220), """) Value = Value.Replace(ChrW(8221), """) Value = Value.Replace("'", "'") Value = Value.Replace("…", "…") Value = Value.Replace("...", "…") Value = Value.Replace("½", "½") Value = Value.Replace("¼", "¼") Value = Value.Replace("¾", "¾") Value = Value.Replace("ï", "ï") Value = Value.Replace("™", "™") Value = Value.Replace("\", "&sor;") Return Value End Function End Module