String (type) - MrKaszeba19/PapajLang GitHub Wiki
String is an entity type used in PapajScript. It stores text strings.
History
String is the second entity type introduced in PS. Its debut was on April 26, 2018 along with release of the 0.4.0 version. The 0.4.2 version was the last version that treated all alphanumerical input as strings, unless it was not a pre-built function. Starting from version 0.4.3, the unknown input triggers an exception, unless quoted.
Features
- All strings are quoted –
"This"is String,thisis not. - Since May 5, 2020 all functions operating on strings are wrapped to a String package.
- The strings may be run as they were PS script. See
String.eval(orString.runin the pre-0.5.1 versions) in String package for more information. - Using
sorton a set of strings sorts them by their size – thestrsortis found since 0.4.3. - Since October 1, 2020 (stable version 0.5.1) the strings are zero-based and evaluated in C-like style by default (it may be changed by using a directive
@stringstart)
Arithmetics
String type supports following artithmetic operations:
String String +(an equivalentString.joinorString.concat)String String -(an equivalent ofString.delete)String Number -(an equivalent ofString.delete)Number String *(an equivalent ofString.copies)String Number *(an equivalent ofString.copies)String Number /(an equivalent ofString.divide)String String /(an equivalent ofString.divide)
Note: All arithmetical operations do not require any additional packages
Examples
"Hello world!""Shalom!""h"