Problems with Sugar.String

I get this error when trying to use :

l := length( str ) ;

  • (E159) The length() compiler magic function expects an array, System.Array, ICollection or ICollectionimplementation.

I also have problems with incompatibility of Char and Sugar.String. After referencing sugar to my project I get :

  • (E62) Type mismatch, cannot assign “java.lang.String” to “String” at method declaration, e.g.

    function HttpFetch( const _url : String = ‘’ ) ;
  • (E62) Type mismatch, cannot assign “RemObjects.Oxygene.System.Char” to "String"

    str := ‘N’ ;
  • (E406) No overloaded method “xxx” with these parameters, best matching overload is "method xxx(value: java.lang.String)"
    for most of my methods using String as parameter.

Thank you for the report, logged as #62389 #62388 #62386

As a workaround you can use:

  1. instead of length() you can use String.Length

  2. and 3) You can use string instead of char, for example:
    str := “N”; - should work.

* (E406) No overloaded method "xxx" with these parameters, best matching overload is "method xxx(value: java.lang.String)" for most of my methods using String as parameter.
Can you please give an example of such methods?

these are methods where I pass a char as a parameter value