replacement for nested countfields nthfield in API2

Is there a way to do this with API 2.0?

If kYDCols <> CountFields( NthField( ts, EndofLine, 2), DSep )-1 Then

kydcols is a number constant
ts string
DSEP is the tab character

I could be wrong but I don’t think I can no longer nest these two.

the API 2 style extensions methods cant be used in all the same cases the old API 1’s could
you may end up needing several lines in some cases

and there is NO compelling reason to switch (unless you’re OCD about deprecation warnings)

Giggle. My OCD is manageable.

Did you try:

If kYDCols <> ts.NthField(EndOfLine, 2).CountFields(DSep)-1 Then

those are the API 1 style string extensions
and there can be issues there as well

What would be the API 2 for NthField and CountFields?

The docs point to String.NthField and String.CountFields, so as I understand NthField(source, separator, fieldNumber) is deprecated but the API 1 style extension stringVariable.NthField(separator, fieldNumber) is the same as API 2 stringVariable.NthField(separator, fieldNumber)
*the code I pasted is from Xojo docs for NthField and String.NthField

In other words (as I understand this): API 2.0, in this case, is just the API 1 style string extensions

my bad - they didnt get renamed (figured they had)