On Wed, 15 Apr 2009, Angel Pais wrote:
> Pls note that in Xbase++ you can use a string ans if it was an array of 
> chars.
> eg:   cString := 'abc'
>       ? cString[2]   --->  'b'
>       ? cString[-1]  --->  'c'

In Harbour you can implement such functionality yourself if you only want.
Below is small code which uses xHarbour like implementation from XHB.LIB
activated by request XHB_LIB.
Just try.
But if you want you can create your own with different semantic.

> Another very usefull feature is the 3rd parameter in:
> At( <cSubString>, <cString> [,<nStartPos>] ) --> nPosition

In Harbour such functionality has HB_AT() function.
Changing standard xbase functions parameters is not good idea in
our opinion because it may create problems when data is exchanged
between programs compiled by different languages or using some common
low level database system, f.e. the fact that xbase++ has 3-rd parameter
in AT() function does not cause that it will be accepted by ADS based
RDDs which also have AT() function and it can be used in some expressions.
To avoid confusion we decided to add new functions instead of changing
existing Clipper/dbase ones.

best regards,
Przemek



#ifndef __XHARBOUR__
   request XHB_LIB
#endif
func main()
   local s:="A", n:=10
   ? s, n
   ? s+n
   ? s-n
   ? s == n, s = n, s < n, s <= n, s > n, s >= n, s != n
   n:=65
   ? s == n, s = n, s < n, s <= n, s > n, s >= n, s != n
   s := "ABC"
   ? s[1], s[2], s[3], s[-1]
return NIL
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to