NthField and API 2.0

I tried it on a brand new project in xojo 2019r21 … and it compiled !

Are you sure you set your version to Global?

Kem, are you talking to Tobias or me ?

To you.

Compile is not the problem, running with 2 NthField (Xojo’s deprecated and our Global) is the problem

Why do you want a Global for that if Str() is not deprecated and can do:

Var t As String = Str("tomatoes,pears,apples").NthField(",", 2)

just added to this report about expanding API 2.0 so it covers the same use cases as API 1.0/Classic API etc

in trying to create a to hex, to octal, to binary that does the job properly there’s a decent use case for the classic functions

Public Function ProperToHex(i8 as int8) as string
  return Right("00000000" + i8.toHex, 8)
End Function

there is no need for extra variables in this function but using API 2 I seem to need to

the API 2 version might look like

Public Function ProperToHex(i8 as int8) as string
  dim result as string = "00000000" + i8.toHex

   return result.right(8)
End Function

which is unnecessary

There’s a separate case about HEX,OCT,BIN, ToBinary,ToHex,ToOctal all not actually doing things “right”
When I pass a 8 bit value I should get back a string that represents 8 bits - not more and not less
Same for 16, 32 and 64 bit values
But thats not how they work :frowning: