'' <b>RAD Extension.</b><br>
'' Returns the directory without the path to it, that is, it returns the name of the directory. if you pass "/home/user/music" it will return "music"
Static Public Function BaseDir(Path As String) As String
Dim strBase As String
Dim stx As New String[]
If InStr(Path, "/") > 0 Then
stx = Split(Path, "/")
strBase = stx[stx.Max]
Endif
Return strBase
End
'' <b>RAD Extension.</b><br>
'' It removes the spaces at the beginning and the end of
'' a <b>s</b> and if there are repeated spaces, it converts them into one.
Static Public Function Trim(s As String) As String
Dim sOut As String
sOut = Trim(RTrim(s))
While InStr(sOut, " ")
sOut = Replace(sOut, " ", " ")
Wend
Return sOut
End
'' <b>RAD Extension.</b><br>
'' Converts the first character of each word to upper case.
'' GO Package strings
Static Public Function Title(s As String) As String
Dim sTmp As String
Dim word As String
Dim aOut As New String[]
sTmp = Trim(RTrim(s))
While InStr(sTmp, " ")
sTmp = Replace(sTmp, " ", " ")
Wend
For Each word In Split(sTmp, " ")
aOut.Add(Upper(Mid(word, 1, 1)) & Mid(Lower(word), 2))
Next
Return aOut.Join(" ")
End