learn | unlearn | relearn

Joe Strout wrote ages ago a toolset for string manipulations beyond Xojo’s out-of-the-box functionality: http://www.strout.net/info/coding/rb/.

I converted this plugin to Xojo API2, available below:

Jeannot-Muller/Xojo-StringUtilsHarness-API2
Xojo-StringUtilsHarness-API2. Contribute to Jeannot-Muller/Xojo-StringUtilsHarness-API2 development by creating an account on GitHub.

Update: I meanwhile converted a second library:

Xojo ArrayUtils API2
After my conversion of Joe Strout’s “StringUtils Harness” to API2 it probably doesn’t come at a surprise that I converted as well his…

I included the original version for two reasons:

  • Ensuring it won’t get lost
  • And for users who want, for education purposes to convert the original project themselves to API2.

As Joe’s original project contains unit tests, it is a fanastic way to learn (and check) the pitfalls of any conversion to API2. Most of it is a diligent but routine piece of work. However, as a few string manipulator (like string.Middle(x,y) in comparison to Mid(string, x, y) are now finally(!) 0-based and not longer 1-based a particular attention has to be spent on such kind of conversions.

Of course some methods could be renamed as the original command has be renamed as well in Xojo API2, but this was not part of this original version (as well to maintain easier backwards compatibility to older code). This can be added in future releases.

The available methods are:

  • Chop
  • Contains
  • ContainsB
  • Count
  • CountFieldsQuoted
  • CountRegEx
  • DecodeCase
  • EditDistance
  • EncodeCase
  • GuessEncoding
  • HexB
  • InStrQuoted
  • InStrReverse
  • InStrReverseB
  • JoinQuoted
  • LineEnding
  • MatchCase
  • Metaphone
  • NthFieldQuoted
  • PadBoth
  • PadLeft
  • PadRight
  • Random
  • Remove
  • Repeat
  • ReplaceRange
  • Reverse
  • ReverseB
  • Soundex
  • SplitByLength
  • SplitByRegEx
  • SplitQuoted
  • SplitToCDbl
  • SplitToInt
  • SplitToVal
  • Sprintf
  • Squeeze
  • StartsWith
  • StartsWithB
  • SwapBytePairs
  • SwapByteQuads
  • Trim
  • WrapLines

Disclaimer: As the original toolset this version is, of course, released as public domain. Though most people will just include it in their own workflows (and make adaptions where needed) a contribution on github is highly appreciated in case of any bugs one might find. I don’t have use for all methods. I checked the unit tests, which are all working, but this alone might not yet be a guarantee that the methods are all bug-free.

Comments

Sign in or become a jeannot-muller.com member to join the conversation.
Just enter your email below to get a log in link.



You’ve successfully subscribed to jeannot-muller.com
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Your link has expired
Success! Check your email for magic link to sign-in.