Bug report?

New to FreeBASIC? Post your questions here.
albert
Posts: 5916
Joined: Sep 28, 2006 2:41
Location: California, USA

Bug report?

Postby albert » Sep 20, 2009 18:27

i'm using the Freebasic for windows latest version. i think its v2.0

The Trim$(string , "0") doesn't trim leading and trailing zeros from the string.

string = "000000000000.0000000000"
should return "." but it returns the whole string of zeros.
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Postby MichaelW » Sep 20, 2009 18:39

Using Version 0.21.0 (03-09-2009), it works for me.

Code: Select all

dim as string s = "0000.0000", s1

print trim( s, "0" )

s1 = trim( s, "0" )

print s1

sleep

Code: Select all

.
.
jevans4949
Posts: 1156
Joined: May 08, 2006 21:58
Location: Crewe, England

Postby jevans4949 » Sep 20, 2009 22:59

MichaelW's code works for me on 0.20, too.

Are you sure you didn't trim with letter O?
Hard
Posts: 135
Joined: Aug 29, 2008 21:13

Postby Hard » Sep 20, 2009 23:10

"broken" versions:

Code: Select all

Dim As String s = "OOOO.OOOO", s1

Print trim( s, "0" )

s1 = trim( s, "0" )

Print s1

Sleep


Code: Select all

Dim As String s = "0000.0000", s1

Print trim( s, "O" )

s1 = trim( s, "O" )

Print s1

Sleep


that is where your problem is. O and 0 are hard to differ with the courier font.
counting_pine
Site Admin
Posts: 6225
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Sep 21, 2009 3:20

albert, can you give us some example code so we can replicate this bug? As shown here, it's easy to produce example cases that do work, so just telling us it doesn't work isn't helpful enough.
The possibility of confusing '0' and 'O' don't seem that likely to me, but I'm unwilling to think there is a bug at this stage.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 3 guests