'' <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'' <b>RAD Extension.</b><br>
'' Returns a string with all its characters converted to ascii or utf-8 when bad codification ocurr.
Static Public Function Flat(s As String) As String
Dim k As Integer = 1
Dim q As Integer
Dim r As Integer
Dim uni As String
Dim stx As New String[]
Dim u As String
Dim rep As String
Dim i As Integer
Repeat
q = InStr(s, "\\U+", k)
If q > 0 Then
Inc r
uni = String.Mid(s, q, 7)
stx.Add(uni)
k = q + String.Len("\\U+")
Endif
Until InStr(s, "\\U+", k) = 0 Or k > String.Len(s)
For Each u In stx
i = Val("&h" & String.Mid(u, 4, 4) & "&")
rep = String.Chr(i)
s = Replace(s, u, rep)
Next
Return s
End'' <b>RAD Extension.</b><br>
'' Fields splits the string s around each instance of one or more consecutive white space characters returning a string[] of substrings of s or an empty string[] if s contains only white space.
'' GO Package strings
Static Public Function Fields(s As String) As String[]
Dim sTmp As String
Dim word As String
Dim aOut As New String[]
While InStr(sTmp, "\t")
sTmp = Replace(sTmp, "\t", " ")
Wend
sTmp = Trim(RTrim(s))
While InStr(sTmp, " ")
sTmp = Replace(sTmp, " ", " ")
Wend
For Each word In Split(sTmp, " ")
aOut.Add(word)
Next
Return aOut
End