Public Shared Function Address(ByVal name As String, ByVal address1 As String, ByVal address2 As _ String, ByVal address3 As String, ByVal address4 As String, ByVal city As String, ByVal state As _ String, ByVal zipCode As String, ByVal country As String) As String Dim result As String = "" Dim csz As String = city csz = AppendValue(csz, ", ", state) csz = AppendValue(csz, " ", zipCode) csz = AppendValue(csz, " ", country) result = AppendLine(result, name) result = AppendLine(result, address1) result = AppendLine(result, address2) result = AppendLine(result, address3) result = AppendLine(result, address4) result = AppendLine(result, csz) Return result End Function '-------------------------------------------------------------------------------------------------- Public Shared Function AppendLine(ByVal input As String, ByVal value As String) As String Return AppendValue(input, vbCrLf, value) End Function '-------------------------------------------------------------------------------------------------- Public Shared Function AppendValue(ByVal input As String, ByVal delimiter As String, ByVal value _ As String) As String Dim result As String = "" Dim flag As Integer = 0 If input.Length <> 0 Then flag += 1 End If If value.Length <> 0 Then flag += 2 End If Select Case flag Case 1 result = input Case 2 result = value Case 3 result = input & delimiter & value End Select Return result End Function
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.