[Gambas-user] trimming extra spaces from within a string.

Brian G brian at westwoodsvcs.com
Wed Nov 11 00:03:55 CET 2020

    close does not return anything when its compiled into c code for some reason!

Thank You
Brian G

----- Original Message -----
From: "Fabien Bodard" <gambas.fr at gmail.com>
To: "Gambas mailing list" <user at lists.gambas-basic.org>
Sent: Tuesday, November 10, 2020 12:06:10 PM
Subject: Re: [Gambas-user] trimming extra spaces from within a string.

This is mine but I'm not able to test it in Fast mode ... But even in
'normal' it is more faster than rolf one :-)

If someone can find why I'm not able to get it running on fast mode...

Public Function FabienTrim(sRaw As String) As String

  Dim s As String
  Dim hStream As File
  Dim bFirst As Boolean = True

  hStream = Open String For Write

  For i As Integer = 0 To Len(sRaw) - 1
    s = sRaw[i]
    If s = " " Then
      If Not bFirst Then
        Write #hStream, s
        bFirst = True
      bFirst = False
      Write #hStream, s

  s = Close #hStream

  If bFirst Then s = Left(s, -1)

  Return s


----[ http://gambaswiki.org/wiki/doc/netiquette ]----

More information about the User mailing list