Skip to content

String Manipulation

Choose a tag to compare

@bharathidas bharathidas released this 20 Aug 13:06
4e02fdc

String Manipulation — Studio Pro 10.24.17

Fixed

codePointAt crashed instead of reporting bad input. Its guard called a trim function that was never defined or imported, so a null input raised ReferenceError: trim is not defined rather than the intended "input should not be empty". The same guards used && where || was meant, so neither could fire for ordinary input, and position == null && position >= 0 could never be true at all.

The action now validates input and position properly, rejects a negative or non-whole position with a clear message, and returns the code point as the declared Big type rather than a raw number.

This defect predates the 10.24.17 upgrade.

Known remaining issues

The following are documented but not yet fixed, as changing them would alter existing signatures:

  • prevGraphemeClusterBreak declares a String return type but returns an integer index, and omits the library's optional fromIndex — so it can only ever find the last break, despite its description.
  • ltrimN documentation says it trims from the end; it trims from the beginning. The text is copied from rtrimN.
  • nextCodePointIndex and nextGraphemeClusterBreak name their second parameter length, but it is a position (fromIndex), not a length.
  • substringAfterLast makes fromIndex mandatory although the library defaults it to the end of the string; passing 0 narrows the search rather than widening it.

Notes

35 actions over the bundled @stdlib/string 0.2.1. Studio Pro 10.24.17, imports with 0 errors. Import StringManipulation.mpk via App Explorer > Import module package.