aScan ?? - xharbour
This is a discussion on aScan ?? - xharbour ; c:="123456789"
? c[3] // prints "3", ok
? aScan(c, { |u| u="3" }) // prints 0 ?????
Shouldn't this call print 3 ?
Thanks...
-
aScan ??
c:="123456789"
? c[3] // prints "3", ok
? aScan(c, { |u| u="3" }) // prints 0 ?????
Shouldn't this call print 3 ?
Thanks
-
Re: aScan ??
Please try for c:={ "1", "2", "3", "4", "5" } in place of c:="12345"
In C character strings are seen as vectors of characters, but in xHarbour
strings aren't arrays,
Ella
<cesarlozada@gmail.com> wrote in message
news:c74c6d5c-7b8b-4b9a-be8a-5d3f10ece048@j20g2000hsi.googlegroups.com...
> c:="123456789"
>
> ? c[3] // prints "3", ok
>
> ? aScan(c, { |u| u="3" }) // prints 0 ?????
>
> Shouldn't this call print 3 ?
>
> Thanks
-
Re: aScan ??
> c:="123456789"
>
> ? c[3] // prints "3", ok
>
> ? aScan(c, { |u| u="3" }) // prints 0 ?????
>
> Shouldn't this call print 3 ?
No, aScan() always returns 0, if the 1st argument is NOT a Clipper ARRAY
type.
To process string's character you may use:
FOR EACH cChar IN cString
...
NEXT
Ron
-
Re: aScan ??
Ron Pinkas schrieb:
>> c:="123456789"
>>
>> ? c[3] // prints "3", ok
>>
>> ? aScan(c, { |u| u="3" }) // prints 0 ?????
>>
>> Shouldn't this call print 3 ?
>
> No, aScan() always returns 0, if the 1st argument is NOT a Clipper ARRAY
> type.
>
> To process string's character you may use:
>
> FOR EACH cChar IN cString
> ...
> NEXT
>
> Ron
>
>
Ascan, as the name already tells, scans an array.
To process a character string you should use
? At( "3" , c )
Detlef