Skip to content

Commit

Permalink
Refactor sanitizing to use class
Browse files Browse the repository at this point in the history
Updating the existing code to use the new class.
  • Loading branch information
joyfullservice committed Oct 25, 2023
1 parent 8e70ad2 commit 1c0d3f4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
4 changes: 3 additions & 1 deletion Version Control.accda.src/modules/clsDbTableData.cls
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Application.ExportXML acExportTable, m_Table.Name, strFile
End If
Perf.OperationEnd
SanitizeXML strFile, False
With New clsSanitize
.SanitizeXML strFile, False
End With
End Select
End If
Next intFormat
Expand Down
4 changes: 3 additions & 1 deletion Version Control.accda.src/modules/clsDbTableDef.cls
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Perf.OperationEnd

' Rewrite sanitized XML as formatted UTF-8 content
strHash = SanitizeXML(strFile, True)
With New clsSanitize
strHash = .SanitizeXML(strFile, True)
End With

Else
' Linked table - Save as JSON
Expand Down
25 changes: 0 additions & 25 deletions Version Control.accda.src/modules/clsSanitize.cls
Original file line number Diff line number Diff line change
Expand Up @@ -732,31 +732,6 @@ Public Function TrimTabs(strText As String) As String
End Function


'---------------------------------------------------------------------------------------
' Procedure : StartsWith
' Author : Adam Waller
' Date : 11/5/2020
' Purpose : See if a string begins with a specified string.
'---------------------------------------------------------------------------------------
'
Public Function StartsWith(strText As String, strStartsWith As String, Optional Compare As VbCompareMethod = vbBinaryCompare) As Boolean
StartsWith = (InStr(1, strText, strStartsWith, Compare) = 1)
End Function


'---------------------------------------------------------------------------------------
' Procedure : EndsWith
' Author : Adam Waller
' Date : 4/29/2021
' Purpose : See if a string ends with a specified string.
'---------------------------------------------------------------------------------------
'
Public Function EndsWith(strText As String, strEndsWith As String, Optional Compare As VbCompareMethod = vbBinaryCompare) As Boolean
EndsWith = (StrComp(Right$(strText, Len(strEndsWith)), strEndsWith, Compare) = 0)
'EndsWith = (InStr(1, strText, strEndsWith, Compare) = len(strtext len(strendswith) 1)
End Function


'---------------------------------------------------------------------------------------
' Procedure : GetIndent
' Author : Adam Waller
Expand Down
25 changes: 25 additions & 0 deletions Version Control.accda.src/modules/modFunctions.bas
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,31 @@ Public Function DeDupString(strText As String, strDuplicated As String) As Strin
End Function


'---------------------------------------------------------------------------------------
' Procedure : StartsWith
' Author : Adam Waller
' Date : 11/5/2020
' Purpose : See if a string begins with a specified string.
'---------------------------------------------------------------------------------------
'
Public Function StartsWith(strText As String, strStartsWith As String, Optional Compare As VbCompareMethod = vbBinaryCompare) As Boolean
StartsWith = (InStr(1, strText, strStartsWith, Compare) = 1)
End Function


'---------------------------------------------------------------------------------------
' Procedure : EndsWith
' Author : Adam Waller
' Date : 4/29/2021
' Purpose : See if a string ends with a specified string.
'---------------------------------------------------------------------------------------
'
Public Function EndsWith(strText As String, strEndsWith As String, Optional Compare As VbCompareMethod = vbBinaryCompare) As Boolean
EndsWith = (StrComp(Right$(strText, Len(strEndsWith)), strEndsWith, Compare) = 0)
'EndsWith = (InStr(1, strText, strEndsWith, Compare) = len(strtext len(strendswith) 1)
End Function


'---------------------------------------------------------------------------------------
' Procedure : SwapExtension
' Author : Adam Waller
Expand Down

0 comments on commit 1c0d3f4

Please sign in to comment.