google-code-export / gambas

Automatically exported from code.google.com/p/gambas
1 stars 0 forks source link

square bracket and LIKE #297

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1) Describe the problem.
Can't compare strings that contains "[]" using LIKE

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: 3.2.1

3) Provide a little project that reproduces the bug or the crash.

Dim a As String = "/music/album-[artist]-song"
Dim b As String = "documents/music/album-[artist]-song.ogg"

'return false here:
Debug b Like "*" & a & "*"

'it also says that [a] = [a],
'but [a] like [a] also returns false!

--------
Maybe it is an expected behaviour, but how can accomplish that task?

Original issue reported on code.google.com by Kokok...@gmail.com on 6 Aug 2012 at 12:46

GoogleCodeExporter commented 9 years ago
Changing "[" to "(" and "]" to ")" works.

Original comment by Kokok...@gmail.com on 6 Aug 2012 at 12:48

GoogleCodeExporter commented 9 years ago
Try \\ before braquets to escape thé character

And read the doc of like
http://gambasdoc.org/help/lang/like?v3

Original comment by gambas...@gmail.com on 6 Aug 2012 at 1:30

GoogleCodeExporter commented 9 years ago
Thanks, changing the pattern using a="/music/album-\\[artist\\]-song" works.

But, i'm using that for a long list of items, should i call replace() everytime 
or there is a faster way?

Original comment by Kokok...@gmail.com on 6 Aug 2012 at 2:55

GoogleCodeExporter commented 9 years ago
Please use the mailing-list for questions about Gambas syntax.

Original comment by benoit.m...@gmail.com on 6 Aug 2012 at 8:16