Where is a dictionary of XOJO terms e.g. count?

I am looking for a definition of “count”.
For instance in the definition of the method


Text.Left(count As Integer) As Text

Supported for all project types and targets.

Returns the first count characters of the Text value.[/quote]

I cannot tell if count is 0 or 1-based and I am getting an extra character.
I also switched from Instr to IndexOf

Indexes are zero-based in API 2. Count is not an index.

Yes. I really do mean count though.

Does it start at 0 or 1. Since I have an extra character, and I go thru definitions and I cannot find one, I ask.

A count of zero would return nothing.

Which also means the Left method is 1-based?
I changed this code to IndexOf and now things aren’t working.

mvL = strFDisplay.IndexOf("<") mvL = strFDisplay.IndexOf(Prm0L) mvR = strFDisplay.IndexOf(Prm0R) + Len(Prm0R) str = strFDisplay.Left(mvR) str = Mid(strFDisplay, mvL, mvR - mvL) str = Replace(str, Prm0L, "" ) str = Replace(str, Prm0R, "" )

A count is always zero based, where zero means “nothing”.

I haven’t followed your code, but I see you are using Mid, which is 1-based. It also doesn’t need the second parameter if you just want till the end of the string. (I’m not sure that you do, just pointing it out.) There is an equivalent API 2 function that is zero based.

Just to clarify my need for clarification. IndexOf returns a -1 if nothing is found.

If it says “index” it should be 0-based. Meaning if nothing is found -1 is the result, otherwise the result is the index or >= 0

Count gives a 1-based number meaning if it’s 0, then bo result is found. Count is there more for UI or human readable result showing.

.Left is 0-based as far as i can tell, since 0 means the first character position

Left takes a count, not an index.

It takes a count but still starts at the first 0-indexed character

Text.Left ( number_of_chars_on_the_left_starting_from_the_first_char_existing__to_be_returned As Integer ) As Text

Avoid negative values or you can raise an exception.

No it doesn’t rise an exception, it returns an empty string like left(0)

So they fixed it after 2016r3 where I got it with myText.Left(-2)

“Count” when it’s the property of a predefined class or datatype in Xojo always means literally, “count” as in “the number of things”. Directory.Count is the number of items in a directory. There can be zero items or there can be a bunch of them. Count means what it says, there’s never any ambiguity.

The argument for Left, Mid, etc is not a count per se, it’s an index, as others have pointed out. Arrays and arrayed control elements like ListBox rows and columns are always 0-based in Xojo, in both API 1 and API 2. String functions like Left, Mid, Right, and Instr are all 1-based, and Instr returns 0 if the search string wasn’t found. In API 2 there are new zero-based equivalent functions with different names, and for the moment, you can use either set arbitrarily - they coexist. The new IndexOf function returns -1 if the search string isn’t found. Pretty sure the language reference has very clear examples of what’s returned for various arguments and example source strings.

Left/Right takes as its parameter a count, as in, “return x number of characters from the start or end of this string”. Mid and Middle take as their first parameter an index, the former 1-based, the latter zero-based.