mn8 Language Reference | Index    

String

SUMMARY: NO ATTRIBUTES  NO ELEMENTS  NO CONSTRUCTORS  OPERATORS SUMMARY  METHODS SUMMARYDETAIL: NO ATTRIBUTES  NO ELEMENTS  NO CONSTRUCTORS  OPERATOR DETAILS  METHOD DETAILS

Description

A lexical string constant enclosed in double quotes evaluates to a value of type string. A string consists of a sequence of characters. The number of characters in a string is called its length. The empty string, denoted by "", contains no characters and has a length of zero. There is no limit to the string size. Strings may be wrap across several lines in MN8 programs. Strings may also contain the escape sequences defined in Escape Sequences. Note that escape sequences are not expanded in strings that are written with the back-quote character.

Usage

        String Expressions
            Expression            Value         Value Type
            -----------           -------       ----------
              "abc"                 "abc"         String
              `ab\nc`               "ab\nc"       String
              "abc" + 'd'           "abcd"        String
              "abc".length          3             Integer
    

Version: 0.1
Authors:Remus Pereni (http://neuro.nolimits.ro)
Inherits: Concept

Operator List

Logical> (String $value)
String+ (Logical $value)
String+ (Real $value)
String+ (Concept $value)
Logical< (String $value)
String+ (Integer $value)
String+ (Character $value)
String+ (String $value)
Logical== (String $value)
String+ (Nil $value)
top

Method List

CharactercharAt (Integer $index)
IntegercompareTo (String $value)
Logicalcontains (Expression $expr)
Logicalcontains (String $value)
LogicalendsWith (String $value)
LogicalequalsIgnoreCase (String $value)
IntegergetLength
SeriesgetLines
SeriesgetTokens (String $delim)
SeriesgetTokensWithDelimiters (String $delim)
IntegerindexOf (String $value)
IntegerindexOf (String $value, Integer $index)
IntegerlastIndexOf (String $value)
IntegerlastIndexOf (String $valiue, Integer $index)
Logicalmatches (Expression $expr)
Stringreplace (Character $oldChar, Character $newChar)
Seriesselect (Expression $expr)
LogicalstartsWith (String $value)
LogicalstartsWith (String $value, Integer $index)
Stringsubstring (Integer $index, Integer $length)
Stringsubstring (Integer $index)
StringtoLowerCase
StringtoStringConcept
StringtoUpperCase
Stringtrim
Stringwrap (Integer $value)
Stringwrap (Integer $value, String $align)
Stringwrap
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getConceptsAtPath, getErrorHandler, getInheritedConcepts, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML

Detailed Operator Info

> (String $value)
Parameters:
$value :

top
+ (Logical $value)
Parameters:
$value :

top
+ (Real $value)
Parameters:
$value :

top
+ (Concept $value)
Parameters:
$value :

top
< (String $value)
Parameters:
$value :

top
+ (Integer $value)
Parameters:
$value :

top
+ (Character $value)
Parameters:
$value :

top
+ (String $value)
Parameters:
$value :

top
== (String $value)
Parameters:
$value :To this will be compared this concept.

Returns true if this concept and the concept given as parameter is equal, false otherwise.

top
+ (Nil $value)
Parameters:
$value :

top

Detailed Method Info

charAt (Integer $index)
Parameters:
$index :The index of the character.
Returns: Character

Returns the character at the specified index.

top
compareTo (String $value)
Parameters:
$value :The string to be compared.
Returns: Integer

The value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument and a value greater than 0 if this string is lexicographically greater than the string argument.

top
contains (Expression $expr)
Parameters:
$expr :The expression to be applied to this concept.
Returns: Logical

Returns true if the specified expression match this concept, false otherwise.

top
contains (String $value)
Parameters:
$value :String to be searched in this concept.
Returns: Logical

Returns true if the specified string is found in this concept, false otherwise.

top
endsWith (String $value)
Parameters:
$value :The suffix.
Returns: Logical

Returns true if the character sequence represented by the parameter is a suffix of the character sequence represented by this concept, false otherwise.

top
equalsIgnoreCase (String $value)
Parameters:
$value :The string to compare this concept against.
Returns: Logical

Returns true if the parameter and this concept are equal, ignoring case, false otherwise.

top
getLength
Returns: Integer

Returns a integer concept representing this concept length.

top
getLines
Returns: Series

Returnes a series with lines from this concept. Where the "\n" character is found there begins the new line. If not found any "\n" character then the returned series will contain a single element which represents this concept.

top
getTokens (String $delim)
Parameters:
$delim :The delimiter.
Returns: Series

Returns a series which contains the tokens of this concept, tokenized by the specified delimiter. Delimiter will not be treated as token.

top
getTokensWithDelimiters (String $delim)
Parameters:
$delim :The delimiter.
Returns: Series

Returns a series which contains the tokens of this concept, tokenized by the specified delimiter, the delimiter is returned as a token.

top
indexOf (String $value)
Parameters:
$value :Any string.
Returns: Integer

If the string argument occurs as a substring within this concept, then the index of the first character of the first such substring is returned if it does not occur as a substring, -1 is returned.

top
indexOf (String $value, Integer $index)
Parameters:
$value :Any string.
$index :The index to start the search from.
Returns: Integer

If the string argument occurs as a substring within this object and the starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.

top
lastIndexOf (String $value)
Parameters:
$value :Any string.
Returns: Integer

If the string argument occurs one or more times as a substring within this concept, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.

top
lastIndexOf (String $valiue, Integer $index)
Parameters:
$valiue :Any string.
$index :The index to start the search from.
Returns: Integer

If the string argument occurs one or more times as a substring within this concept at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned.

top
matches (Expression $expr)
Parameters:
$expr :The expression to be applied to this concept.
Returns: Logical

Returns true if the specified expression match this concept, false otherwise.

top
replace (Character $oldChar, Character $newChar)
Parameters:
$oldChar :The oldChar to be replaced.
$newChar :The newChar with which will be replaced.
Returns: String

If the character oldChar does not occur in the character sequence represented by this concept, then a reference to this concept is returned. Otherwise, a new string concept is created that represents a character sequence identical to the character sequence represented by this string concept, except that every occurrence of oldChar is replaced by an occurrence of newChar.

top
select (Expression $expr)
Parameters:
$expr :The expression to be applied to this concept.
Returns: Series

Select that portion from this concept which match the specified expression.

top
startsWith (String $value)
Parameters:
$value :The prefix.
Returns: Logical

Returns true if the character sequence represented by the argument is a prefix of the character sequence represented by this string concept, false otherwise.

top
startsWith (String $value, Integer $index)
Parameters:
$value :The prefix.
$index :From where to begin looking in the string.
Returns: Logical

Returns true if the character sequence represented by the argument is a prefix of the substring of this object starting at index given as parameter, false otherwise.

top
substring (Integer $index, Integer $length)
Parameters:
$index :The begining index, inclusive.
$length :The ending index, exclusive.
Returns: String

Returns a new string concept that is a substring of this string concept. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.

top
substring (Integer $index)
Parameters:
$index :The begining index, inclusive.
Returns: String

Returns a new string concept that is a substring of this string concept. The substring begins with the character at the specified index and extends to the end of this string.

top
toLowerCase
Returns: String

Converts all of the characters in this string concept to lower case and returns the resulted string concept.

top
toStringConcept
Returns: String

Returns a new string concept which is represents this concept.

top
toUpperCase
Returns: String

Converts all of the characters in this string concept to upper case and returns the resulted string concept.

top
trim
Returns: String

Removes white space from both ends of this string.

top
wrap (Integer $value)
Parameters:
$value :Number of columns
Returns: String

Returns a new string concept representing this concept wrapped to the given column number and aligned to left by default.

top
wrap (Integer $value, String $align)
Parameters:
$value :Number of columns
$align :Alignment (ex. left, right, center)
Returns: String

Returns a new string concept representing this concept wrapped to the given column number and aligned as it is specified.

top
wrap
Returns: String

Returns a new string concept representing this concept wrapped to 72 column and aligned to left by default.

top