Updates On Xojo API2 Conversion

Jeannot Muller
Dec 29, 2020 · 2 min read

As mentioned, I converted two Xojo libraries from API1 to API2:

  1. Xojo StringUtils Harness
  2. Xojo ArrayUtils

This article is about changes made after the initial conversion and reported by other Xojo users.

Where I can, I’ll comment those changes. The involved repositories are always updated on my github repositories before updating this article.

Thank you, to all contributors!

array.Count

Robert Livingstone reported this change request. Robert is right that since Xojo Release 2019r2 we can make use of this command, and it is definitely more elegant than :

array.LastIndex + 1

It’s important to note that if you analyze your project in the Xojo IDE it will point you to convert the former Ubound( array ) command to array.LastIndex but doesn’t give you of course the hint that array.Count exists. For better readability you should memorize this new command.

array.ResizeTo

This is yet another new command where the Project Analyse doesn’t point you to, but again Robert Livingstone did — thank you! From reading the Xojo documentation Redim is as well outdated:

Redim exists for Visual Basic compatibility only. Use Arrays.ResizeTo instead.

I updated the repositories and all “Redim”s are now replaced by the respective array.ResizeTo commands.

Please note that the Xojo IDE doesn’t point you to the fact that “Var” is preferred over “Dim”. However, I had made that change already in the original version.

  • Method HexB used the deprecated version “RBVersion” in Stringutils (This item was deprecated in version 2013r1). Command replaced with “XojoVersion” as a replacement.
  • In the comments for EditDistance changed “StringUtils” to “strings”.
  • In the “Metaphone” method of the StringUtils the “Dim” statements remained. They are now replaced by “Var”.

string.EndsWith

Version 2.5 Renamed method “EndsWidth” to “EndsWithOld” as Xojo has implemented “EndsWidth” into the core in late 2019.

Image for post
Image for post

Learn Xojo

Everything About Developing with Xojo.com

Jeannot Muller

Written by

Managing director at teccompanion.com, physician, founder, developer and blogger.

Learn Xojo

Code snippets, tips and tricks to develop like a pro with the fantastic xojo.com tool on Windows, macOS, iOS, Web and Linux

Jeannot Muller

Written by

Managing director at teccompanion.com, physician, founder, developer and blogger.

Learn Xojo

Code snippets, tips and tricks to develop like a pro with the fantastic xojo.com tool on Windows, macOS, iOS, Web and Linux

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store