[Gambas-user] why this could not be? error in runtime?

PICCORO McKAY Lenz mckaygerhard at ...626...
Sat Jul 29 05:53:07 CEST 2017


HEY TONY; ITS PICCORO; NOT PICARO! GRRRRR

in the playground wprks perfectly, i not have 3.10, but in the job i have
3.1 and at my home 3.5
its a bug in 3.9 and 3.8, *with 3.1 works perfectly in debian squeeze (very
older but better)*

2017-07-28 21:02 GMT-04:00 Adrien Prokopowicz <adrien.prokopowicz at ...626...>
:

> Actually, his original code is correct. For me it runs without error in
> the IDE using
> the 3.10 development version, but the editor is indeed having trouble
> matching the
> parentheses.
>
me too, the edtor has some problems, when the ide made a word wrap, and i
have thesame behaviour, parentheses does not matching correctly..


> I also tried it on the playground (which also uses 3.10) and it works
> fine : https://gambas-playground.proko.eu/?gist=97ed16795393aa3b689
> 13025e5d2b83c .
>
tested, me too..


> However the playground's editor does match the parentheses correctly. :)
>
jajaja excelent work!


>
> Which Gambas version are you using ? There may be an old bug here.
>
3.9.1 with some git patches..

in the job i have 3.1 and at my home 3.5

its a bug in 3.9 and 3.8, with 3.1 works perfectly in debian squeeze (very
older but better)



Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-07-28 23:46 GMT-04:00 Tony Morehen <tmorehen at ...3602...>:

> It's difficult to say for sure what's happening without Piccaro's test
> strings.  However, 2 things do come to mind.
>
> First, according to Gambas doc, InStr(strinchar, ")", -n) does a left to
> right search for ")", starting at -n  characters from the end of
> strinchar.  So if Instr doesn't find ")", it will return 0, which, in
> conjunction with the second -1, will cause mid to drop the last character
> of strinchar.  So to get the answer you want, use RInstr(strinchar,")").
> which will do a right to left search for ")", starting at the end of
> strinchar.
>
> Second, there may be a bug in gambas, or the documentation needs to make
> clear what end of string means.  This is best explained by example:
>
> Instr("(foo)",")",-1) returns 5
> Instr("(foo)f",")",-1) returns 5
> Instr("(foo)ff",")",-1) returns 0
>
> This means that Instr(s1,s2,-1) begins its search one character before the
> last character of the string.  So end of string actually means last
> character of the string and the docs should make that explicit or there is
> a bug if the intended meaning of end of string is the position after the
> last character of the string.
>
>
>
> On 2017-07-28 09:31 PM, Fernando Cabral wrote:
>
>> Piccoro, sorry for my previous information. Something was missing.
>> In fact, both versions work the same:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *  strinchar = "test )after)r"    positionlen = (InStr(strinchar, ")", -1)
>> - 1)    Print strinchar    Print positionlen    strinchar = Mid(strinchar,
>> 1, positionlen)     Print strinchar    strinchar = "test )after)r"
>> strinchar = Mid(strinchar, 1, (InStr(strinchar, ")", -1) - 1))    Print
>> strinchar *
>> Both print  "test )after"
>>
>> - fernando
>>
>> 2017-07-28 22:02 GMT-03:00 Adrien Prokopowicz <
>> adrien.prokopowicz at ...626...>
>> :
>>
>> Le Sat, 29 Jul 2017 02:40:44 +0200, Jussi Lahtinen <
>>> jussi.lahtinen at ...626...> a écrit:
>>>
>>> No... again. My initial mail was correct. It should be:
>>>
>>>> strinchar = Mid(strinchar, 1, (InStr(strinchar, ")", -1) - 1))
>>>>
>>>> But the IDE makes highlighting bug with the brackets.
>>>>
>>>>
>>>> Jussi
>>>>
>>>> On Sat, Jul 29, 2017 at 3:33 AM, Jussi Lahtinen <
>>>> jussi.lahtinen at ...626...
>>>> wrote:
>>>>
>>>> Hmmm... sorry, no mistake... I will look closer.
>>>>
>>>>>
>>>>> Jussi
>>>>>
>>>>> On Sat, Jul 29, 2017 at 3:33 AM, Jussi Lahtinen <
>>>>> jussi.lahtinen at ...626...>
>>>>> wrote:
>>>>>
>>>>> Because the line makes no sense at all. Try to remove ")".
>>>>>
>>>>>>
>>>>>> Jussi
>>>>>>
>>>>>> On Fri, Jul 28, 2017 at 11:55 PM, PICCORO McKAY Lenz <
>>>>>> mckaygerhard at ...626...> wrote:
>>>>>>
>>>>>> in the following code:
>>>>>>
>>>>>>>      strinchar = Mid(strinchar, 1, InStr(strinchar, ")", -1) - 1)
>>>>>>>
>>>>>>> IDE said error invalid argument, but if i do:
>>>>>>>
>>>>>>>      psotionlen = InStr(strinchar, ")", -1) - 1
>>>>>>>       strinchar = Mid(strinchar, 1, psotionlen)
>>>>>>>
>>>>>>> works, why?
>>>>>>>
>>>>>>> i wnat to remove the last occurence of a char but bybass some
>>>>>>> possible
>>>>>>> spaces/chars at the end of string
>>>>>>>
>>>>>>> Lenz McKAY Gerardo (PICCORO)
>>>>>>> http://qgqlochekone.blogspot.com
>>>>>>>
>>>>>>> Actually, his original code is correct. For me it runs without error
>>> in
>>> the IDE using
>>> the 3.10 development version, but the editor is indeed having trouble
>>> matching the
>>> parentheses.
>>>
>>> I also tried it on the playground (which also uses 3.10) and it works
>>> fine : https://gambas-playground.proko.eu/?gist=97ed16795393aa3b689
>>> 13025e5d2b83c .
>>>
>>> However the playground's editor does match the parentheses correctly. :)
>>>
>>> Which Gambas version are you using ? There may be an old bug here.
>>>
>>> --
>>> Adrien Prokopowicz
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Gambas-user mailing list
>>> Gambas-user at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>
>>>
>>
>>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list