I found thx.core’s thx.Strings, http://thx-lib.org/api/thx/Strings.html, and it has a wrapColumns function, so I did haxelib install thx.core, added --library thx.core to by hxml, and tried:
import thx.Strings;
class Main {
public static function main() {
var content = "line won lorem ipsum
line too lorem ipsum
line tree lorem ipsum
";
content = Strings.wrapColumns(content, columns = 30);
Sys.println(content);
}
}
but upon compilation I get:
/home/john/haxelib/thx,core/0,43,0/src/thx/Eithers.hx:157: characters 12-17 : Warning : Potential typo detected (expected similar values are Right). Consider using `var right` instead
/home/john/haxelib/thx,core/0,43,0/src/thx/Eithers.hx:164: characters 12-17 : Warning : Potential typo detected (expected similar values are Right). Consider using `var right` instead
/home/john/haxelib/thx,core/0,43,0/src/thx/Iterators.hx:54: character 14 : Unterminated markup literal
Thanks, Jens! It works now, though I also get a whole bunch of warnings about haxe.Utf8 being deprecated and UnicodeString should be used instead.
In https://api.haxe.org/haxe/Utf8.html I don’t see any deprecation note there, but I do see one in the source file itself. Also, I don’t see a UnicodeString anywhere at https://api.haxe.org/, though I do indeed see it in the source at std/UnicodeString.hx.
Incidentally, a few of those deprecation warnings don’t make sense to me:
/home/john/haxelib/thx,core/git/src/thx/Dynamics.hx:208: characters 14-85 : Warning : haxe.Utf8 is deprecated. Use UnicodeString instead.
/home/john/haxelib/thx,core/git/src/thx/Dynamics.hx:220: characters 20-41 : Warning : haxe.Utf8 is deprecated. Use UnicodeString instead.
/home/john/haxelib/thx,core/git/src/thx/Dynamics.hx:226: characters 20-65 : Warning : haxe.Utf8 is deprecated. Use UnicodeString instead.
That file doesn’t contain any use of Utf8… but those lines do call thx.Strings.compare() (which in turn calls the deprecated Utf8 methods). Why would Dynamics.hx cause warnings if it’s not itself directly calling the Utf8 static methods?