Base: migrate functions from other modules, add new functions

This commit is contained in:
Jonathan Jenne
2023-08-22 08:38:21 +02:00
parent 72f7211d63
commit f6046aec54
5 changed files with 760 additions and 669 deletions

View File

@@ -21,6 +21,11 @@ Public Class StringEx
If Char.IsLetterOrDigit(oChar) Then
oBuilder.Append(Char.ToLower(oChar))
oWasHyphen = False
ElseIf oChar = "_"c Or oChar = "-"c Then
oBuilder.Append(oChar)
oWasHyphen = True
ElseIf Char.IsWhiteSpace(oChar) AndAlso Not oWasHyphen Then
oBuilder.Append("-"c)
oWasHyphen = True
@@ -111,6 +116,22 @@ Public Class StringEx
Return GetChecksum(pStringToCheck).Substring(0, 32)
End Function
Public Shared Function GetDateString() As String
Return $"{Now:yyyy\\MM\\dd}"
End Function
Public Shared Function GetDateString(pDate As Date) As String
Return $"{pDate:yyyy\\MM\\dd}"
End Function
Public Shared Function GetDateTimeString() As String
Return $"{Now:yyyy-MM-dd_hh-mm-ffff}"
End Function
Public Shared Function GetDateTimeString(pDate As Date) As String
Return $"{pDate:yyyy-MM-dd_hh-mm-ffff}"
End Function
Friend Class InvalidChars
Public Shared Filenames As String = Regex.Escape(New String(IO.Path.GetInvalidFileNameChars()))
Public Shared Paths As String = Regex.Escape(New String(IO.Path.GetInvalidPathChars()))