tincho   15-04-2021, 11:03
#1
Esta función esta interesante porque permite lograr una lista de "Campos" a partir de una cadena de texto separada por espacios o tabuladores.
Código:
'' <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
Saludos.
Última modificación: 05-06-2022, 20:17 por tincho.

1 Saludo.
  
Usuarios navegando en este tema: 2 invitado(s)
Powered By MyBB, © 2002-2024 MyBB Group.
Made with by Curves UI.