[Gambas-user] bug in function Trim(string) ?

Charlie karl.reinl at ...9...
Sat Feb 1 15:18:58 CET 2003


Jochen Georges schrieb:

>hello gambasians
>
>is this a bug? 
>
>my code:
>Label1.Text = Trim("aa bb cc dd")
>
>the label shows : "aa bb cc dd"
>but it should show : "aabbccdd".
>
>
>thanks for any hint
>
>
>beste gruesse
>jochen
>
>  
>
Salut Jochen,

no it works right.
Trim leaves only leading and following blanks (whitspaces).

- You can use it to compare Strings from a User input

if Trim (" gambas ") = "gambas" then
or better (if you work with a System who is not Case Sensitive ):
if Upper$(Trim (" Gambas "))  = "GAMBAS" then

- or returned String, if you want to know  for exsample if there is 
something in the String.
  sReturn = "        "
  if len(sReturn) > 0 then ' here it is 8  and you print 8 blanks
        Print sReturn
  else
        Print "Empty String"
  endif

  if len(Trim(sReturn)) > 0 then ' here it is 0  and you print "Empty 
String"
        Print sReturn
  else
        Print "Empty String"
  endif

You have also Ltrim$ and Rtrim$

Charlie

 





More information about the User mailing list