This package contains the NetLogo string extension.
see https://github.com/NetLogo/String-Extension/releases
The following reporters are provided:
upper-case,lower-case-- alter the letter case of stringsstarts-with?,ends-with?-- match a string against the start or end of another stringcontains-rex?-- search in strings using standard regular expressions, returns a boolean if the regex is foundrex-replace-first,rex-replace-all-- replaces instances of a regex with a stringrex-split-- splits the string into a list by a regexfrom-file-- read an entire file into a string with one commandmessage-digest-5-- generate the MD5 hash for a stringhash-code-- generate the MD5 hash for a stringfrom-list-- turns a list into a stringto-listturns a string into a list, so it can be iterated over withforeachtrimreplaces preceding and trailing spaces.
Run make.
If compilation succeeds, string.jar will be created.
To run the tests in tests.txt, run make test.
To build a release package, run make string.zip.
Ideas for possible additional primitives:
ascii-code <character>-- returns the ASCII index of the given character (the first character of the string), or 0 for non-ASCII charactersfrom-ascii <integer>-- returns the ASCII character corresponding to the given small integer indexlast-index-of <needle> <haystack>-- reports the index of the last occurrence of needle in haystack, or false, if needle does not occursplit-on-character <string> <single-char-delimiter>-- reports a list by splitting string using the given single character`split-on-string <string> <string-delimiter>-- reports a list formed by splitting string using the string-delimiterposition-regex <regex-needle> <haystack>
The string extension was written by James Steiner of turtleZERO.com.
The NetLogo string extension is in the public domain. To the extent possible under law, James Steiner has waived all copyright and related or neighboring rights.
