string2 = Strings.substring(string, startIndex, endIndex);
This function returns the substring from position startIndex up to and including position endIndex of "string" . The substring computation has the following properties:
startIndex
is non-positive, it is set to 1 and a warning is raised.startIndex
exceeds the string length, the returned substring is empty.endIndex
is negative, it is set to the startIndex
and a warning is raised. The returned substring is the single character at position startIndex
of string
.endIndex
is non-negative and less than the startIndex
, the returned substring is empty.endIndex
exceeds the string length, it is set to the string length.string1 := "This is line 111"; string2 := Strings.substring(string1,9,12); // string2 = "line" string3 := Strings.substring(string1,9,0); // string3 = ""
pure function substring extends Modelica.Icons.Function; input String string "String from which a substring is inquired"; input Integer startIndex(min = 1) "Character position of substring begin (index=1 is first character in string)"; input Integer endIndex "Character position of substring end"; output String result "String containing substring string[startIndex:endIndex]"; end substring;