tincho 15-04-2021, 11:45
Esta función devuelve el nombre del directorio inmediatamente superior de una ruta que se pasa y ademas quita todos los niveles superiores a este, trabaja similar a la función nativa BaseName pero con el directorio.
Código:
'' <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
Saludos
tincho 15-04-2021, 11:13
Esta la hizo Christof, de la lista internacional de Gambas, y yo la adapte.
Fue la que obtuvo la marca de velocidad mas alta (con FAST).
Código:
'' <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
Saludos.
tincho 15-04-2021, 11:11
Esta hace lo mismo que la función de Go que se llama igual.
Código:
'' <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
Saludos.
Páginas (570):    1 468 469 470 471 472 570   
Bienvenido, Invitado
Tienes que registrarte para poder participar en nuestro foro.
Recordarme?
Miembros: 303
Último miembro: Pablo
Temas del foro: 1,760
Mensajes del foro: 9,148
Últimos temas
Visual Studio Code con Ga...
Foro: General
Último mensaje por: guizans, 07-03-2026, 14:24
Respuestas: 2 - Vistas: 239
WebForm con mysql gridvie...
Foro: WebApp/WebForms
Último mensaje por: vjarvelo, 03-03-2026, 16:32
Respuestas: 2 - Vistas: 2,951
Sobre la proteccion del c...
Foro: General
Último mensaje por: Shordi, 19-02-2026, 11:07
Respuestas: 7 - Vistas: 666
Sobre LinuxMint
Foro: Mundo Linux
Último mensaje por: guizans, 17-02-2026, 21:46
Respuestas: 2 - Vistas: 359
Problema con creación de ...
Foro: Bases de Datos
Último mensaje por: guizans, 17-02-2026, 21:42
Respuestas: 4 - Vistas: 521
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.