infix *
String.infix *
repeat string given number of times
Precondition
pre n ≥ 0
Fields
utf8 Sequence u8[Redefinition of String.utf8]¶[src]
Comment of String.utf8
any concrete string must implement utf8Constructors
Functions
as_c_string(LM:mutate) => LM.array u8[Inherited from String]¶[src]
returns a zero terminated array of
the bytes of this String
the bytes of this String
as_string => String[Inherited from String]¶[src]
converting a string to a string is just returning string.this
byte_count => i64[Inherited from String]¶[src]
length of this string in bytes
chunk(n i64) => Sequence String[Inherited from String]¶[src]
splits this string in chunks of codepoint length n, the last part might be shorter
codepoint_count => i64[Inherited from String]¶[src]
length of this string in codepoints
codepoints => Sequence codepoint[Inherited from String]¶[src]
convert this string into a Sequence of codepoint and errors for encoding problems
found in the underlying utf8 bytes
found in the underlying utf8 bytes
codepoints_and_errors => list (outcome codepoint)[Inherited from String]¶[src]
convert this string into a list of codepoint and errors for encoding problems
found in the underlying utf8 bytes
found in the underlying utf8 bytes
contains(substring String) => bool[Inherited from String]¶[src]
does this string contain the given 'substring'
contains_whitespace => bool[Inherited from String]¶[src]
returns true if string contains whitespace
count(substring String) => i64[Inherited from String]¶[src]
count number of occurrences of given 'substring' in this string
cut(sep String) => string_cut_result[Inherited from String]¶[src]
Cuts out the first appearance of the string sep from this string, in other words,
returns a tuple of two strings and a bool, the first string is the substring before
the first appearance of sep, the second string is the substring after the first
appearance of sep. The bool result is true iff sep appears in this string.
If sep does not appear in this string at all, return this string as the first string,
the empty string as the second, and false as the bool.
returns a tuple of two strings and a bool, the first string is the substring before
the first appearance of sep, the second string is the substring after the first
appearance of sep. The bool result is true iff sep appears in this string.
If sep does not appear in this string at all, return this string as the first string,
the empty string as the second, and false as the bool.
dynamic_apply(R:Any,F:Typed_Function R,f F) => R[Inherited from Any]¶[src]
dynamic_apply -- apply `f.call` to `Any.this`'s dynamic type and value
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
dynamic_type => Type[Inherited from Any]¶[src]
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
ends_with(suffix String) => bool[Inherited from String]¶[src]
check if this string ends with given suffix
find(substring String) => option i64[Inherited from String]¶[src]
find (utf8-byte-) index of 'substring' within this string.
find(substring String,from i64) => option i64[Inherited from String]¶[src]
find (utf8-byte-) index of 'substring' within this string,
starting the search at 'from'.
the index of 'substring' is given in relation to the start
of the entire string.
starting the search at 'from'.
the index of 'substring' is given in relation to the start
of the entire string.
find_last(substring String) => option i64[Inherited from String]¶[src]
find (utf8-byte-) index of last occurrence of 'substring'
within this string.
within this string.
infix +(other Any) => String[Inherited from String]¶[src]
concatenate string with string representation of another object
is_ascii => bool[Inherited from String]¶[src]
Does this String consist of nothing but ascii codepoints?
is_blank => bool[Inherited from String]¶[src]
returns true if string is empty or contains whitespace only
lines => Sequence String[Inherited from String]¶[src]
split string at line feeds
lower_case => String[Inherited from String]¶[src]
convert this string to lower case
pad(n i64) => String[Inherited from String]¶[src]
pad this string at the end with spaces such that its `codepoint_count` is at least `n`.
pad(p String,n i64) => String[Inherited from String]¶[src]
pad this string at the end with `p` such that its `codepoint_count` is at least `n`.
pad_center(n i64) => String[Inherited from String]¶[src]
pad this string at the beginning and at the end with spaces such that its `codepoint_count` is at least `n`.
In case the required number of codepoints to add is odd, the padding at the end will be longer.
In case the required number of codepoints to add is odd, the padding at the end will be longer.
pad_center(p String,n i64) => String[Inherited from String]¶[src]
pad this string at the beginning and at the end with `p` such that its `codepoint_count` is at least `n`.
In case the required number of copies of `p` is odd, the padding at the end will be longer.
In case the required number of copies of `p` is odd, the padding at the end will be longer.
pad_codepoint_start(l i64,s String) => String[Inherited from String]¶[src]
return string of at least length l by
padding codepoint s to start of string
padding codepoint s to start of string
pad_left(n i64) => String[Inherited from String]¶[src]
pad this string at the beginning with spaces such that its `codepoint_count` is at least `n`.
pad_left(p String,n i64) => String[Inherited from String]¶[src]
pad this string at the beginning with `p` such that its `codepoint_count` is at least `n`.
parse_i128 => outcome i128[Inherited from String]¶[src]
parse this string as a signed 128-bit integer value
parse_i128(base u64) => outcome i128[Inherited from String]¶[src]
parse_i128_binary => outcome i128[Inherited from String]¶[src]
parse_i128_hex => outcome i128[Inherited from String]¶[src]
parse_i128_octal => outcome i128[Inherited from String]¶[src]
parse_i32 => outcome i32[Inherited from String]¶[src]
parse this string as a signed 32-bit integer value
parse_i32_binary => outcome i32[Inherited from String]¶[src]
parse_i32_hex => outcome i32[Inherited from String]¶[src]
parse_i32_octal => outcome i32[Inherited from String]¶[src]
parse_i64 => outcome i64[Inherited from String]¶[src]
parse this string as a signed 64-bit integer value
parse_i64_binary => outcome i64[Inherited from String]¶[src]
parse_i64_hex => outcome i64[Inherited from String]¶[src]
parse_i64_octal => outcome i64[Inherited from String]¶[src]
parse_int => outcome int[Inherited from String]¶[src]
parse this string as an int value of arbitrary size
parse_int_binary => outcome int[Inherited from String]¶[src]
parse_int_hex => outcome int[Inherited from String]¶[src]
parse_int_octal => outcome int[Inherited from String]¶[src]
parse_integer(T:integer,base T) => outcome T[Inherited from String]¶[src]
parse this string as a integer value given as type parameter
parse_u128 => outcome u128[Inherited from String]¶[src]
parse this string as an unsigned 128-bit integer value
parse_u128(base u64) => outcome u128[Inherited from String]¶[src]
parse_u128_binary => outcome u128[Inherited from String]¶[src]
parse_u128_hex => outcome u128[Inherited from String]¶[src]
parse_u128_octal => outcome u128[Inherited from String]¶[src]
parse_u32 => outcome u32[Inherited from String]¶[src]
parse this string as an unsigned 32-bit integer value
parse_u32_binary => outcome u32[Inherited from String]¶[src]
parse_u32_hex => outcome u32[Inherited from String]¶[src]
parse_u32_octal => outcome u32[Inherited from String]¶[src]
parse_u64 => outcome u64[Inherited from String]¶[src]
parse this string as an unsigned 64-bit integer value
parse_u64_binary => outcome u64[Inherited from String]¶[src]
parse_u64_hex => outcome u64[Inherited from String]¶[src]
parse_u64_octal => outcome u64[Inherited from String]¶[src]
prefix $ => String[Inherited from Any]¶[src]
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
replace(old String,new String) => String[Inherited from String]¶[src]
replace all occurrences of old by new
replace(old String,new String,n u64) => String[Inherited from String]¶[src]
replace the first n occurrences of old by new
split => Sequence String[Inherited from String]¶[src]
Split string separated by (ASCII) white space
Leading and trailing white space is ignored, repeated white space is treated
like a single white space
The result is a, possibly empty, list of separate non-empty strings.
Leading and trailing white space is ignored, repeated white space is treated
like a single white space
The result is a, possibly empty, list of separate non-empty strings.
split_after(s String) => Sequence String[Inherited from String]¶[src]
split string after s, that is do the same thing as split but
include the separator s in the resulting strings
include the separator s in the resulting strings
split_after_n(s String,n u32) => Sequence String[Inherited from String]¶[src]
split string after s, for at most n occurrences of s
if s occurs in the string less than n times, the resulting list will have
less than n elements
if s occurs in the string less than n times, the resulting list will have
less than n elements
split_at_byte(i i64) => tuple String String[Inherited from String]¶[src]
split String at i
example:
(0..5).for_each (i -> say <| "hallo".split_at_byte i)
(, hallo)
(h, allo)
(ha, llo)
(hal, lo)
(hall, o)
(hallo, )
example:
(0..5).for_each (i -> say <| "hallo".split_at_byte i)
(, hallo)
(h, allo)
(ha, llo)
(hal, lo)
(hall, o)
(hallo, )
split_if(p Unary bool codepoint) => Sequence String[Inherited from String]¶[src]
Splits this string at codepoints where p is true and returns the result as a
list of strings. No empty strings are produced: a run of adjacent matches
acts as a single separator, and leading or trailing matches are skipped.
list of strings. No empty strings are produced: a run of adjacent matches
acts as a single separator, and leading or trailing matches are skipped.
split_n(s String,n u32) => Sequence String[Inherited from String]¶[src]
split string at s, for at most n occurrences of s
if s occurs in the string less than n times, the resulting list will have
less than n elements
if s occurs in the string less than n times, the resulting list will have
less than n elements
starts_with(prefx String) => bool[Inherited from String]¶[src]
check if this string starts with given prefix
substring(from i64) => String[Inherited from String]¶[src]
create substring of this string consisting of bytes from (inclusive) .. byte_count (exclusive).
substring(from i64,to i64) => String[Inherited from String]¶[src]
create substring of this string consisting of bytes from (inclusive) .. to (exclusive).
substring_codepoint(from i64) => String[Inherited from String]¶[src]
create substring of this string consisting of codepoints from (inclusive) .. codepoint_count (exclusive).
substring_codepoint(from i64,to i64) => String[Inherited from String]¶[src]
create substring of this string consisting of codepoints from (inclusive) .. to (exclusive).
to_valid_utf8 => String[Inherited from String]¶[src]
replaces invalid UTF-8 byte sequences in this string with the Unicode
replacement character (U+FFFD).
replacement character (U+FFFD).
to_valid_utf8(replacement String) => String[Inherited from String]¶[src]
replaces invalid UTF-8 byte sequences in this string with the given
string.
string.
trim => String[Inherited from String]¶[src]
remove leading and trailing white space from this string
trim(cond choice (Unary bool u8) (Unary bool codepoint)) => String[Inherited from String]¶[src]
remove leading and trailing bytes where cond matches
cond can be a predicate of either an u8 or a codepoint.
cond can be a predicate of either an u8 or a codepoint.
trim_end(cond choice (Unary bool u8) (Unary bool codepoint)) => String[Inherited from String]¶[src]
remove trailing bytes where cond matches
cond can be a predicate of either an u8 or a codepoint.
cond can be a predicate of either an u8 or a codepoint.
trim_start => String[Inherited from String]¶[src]
remove leading white space from this string
trim_start(cond choice (Unary bool u8) (Unary bool codepoint)) => String[Inherited from String]¶[src]
remove leading bytes where cond matches
cond can be a predicate of either an u8 or a codepoint.
cond can be a predicate of either an u8 or a codepoint.
truncate(max_codepoints i64) => String[Inherited from String]¶[src]
this String but limited to max_codepoints
if String is longer than max_codepoints '…' is appended
if String is longer than max_codepoints '…' is appended
upper_case => String[Inherited from String]¶[src]
convert this string to upper case
write_to(LM:mutate) => outcome unit[Inherited from String]¶[src]
write the bytes of this String to
writer of : (io.buffered LM).Writer
writer of : (io.buffered LM).Writer
Type Features
type.as_string => String[Inherited from Type]¶[src]
string representation of this type to be used for debugging.
result has the form "<name>", but this might change in the future
result has the form "<name>", but this might change in the future
type.concat => Monoid String[Inherited from String]¶[src]
monoid of strings with infix + operation.
type.concat(sep String) => Monoid String[Inherited from String]¶[src]
monoid of strings with infix '+ sep +' operation, i.e., concatenate with
given separator
given separator
type.concat(a String,b String) => String[Inherited from String]¶[src]
concat strings a and b by
concatenating their byte sequences.
concatenating their byte sequences.
type.dynamic_type => Type[Inherited from Type]¶[src]
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
Note: Typechecking is undecidable when 'type' is a type, Mark B. Reinhold, 1989
see: https://dspace.mit.edu/bitstream/handle/1721.1/149366/MIT-LCS-TR-458.pdf?sequence=6
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
Note: Typechecking is undecidable when 'type' is a type, Mark B. Reinhold, 1989
see: https://dspace.mit.edu/bitstream/handle/1721.1/149366/MIT-LCS-TR-458.pdf?sequence=6
type.equality(a property.orderable.this,b property.orderable.this) => bool[Inherited from orderable]¶[src]
equality implements the default equality relation for values of this type.
This relation must be
- reflexive (equality a a),
- symmetric (equality a b = equality b a), and
- transitive ((equality a b && equality b c) : equality a c).
result is true iff 'a' is considered to represent the same abstract value
as 'b'.
This relation must be
- reflexive (equality a a),
- symmetric (equality a b = equality b a), and
- transitive ((equality a b && equality b c) : equality a c).
result is true iff 'a' is considered to represent the same abstract value
as 'b'.
type.from(data choice (Sequence u8) (Sequence codepoint)) => String[Inherited from String]¶[src]
create string from the given data
where data might either be utf8 bytes or codepoints
where data might either be utf8 bytes or codepoints
type.hash_code(a String.this) => u64[Inherited from String]¶[src]
create hash code from a string
type.infix :(T:Any) => bool[Inherited from Type]¶[src]
Is this type assignable to a type parameter with constraint `T`?
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
type.is_continuation_byte(byte u8) => bool[Inherited from String]¶[src]
is this a valid continuation byte in a utf8 sequence?
type.is_multi_byte_start_byte(byte u8) => bool[Inherited from String]¶[src]
is byte a start of a 2,3 or 4 byte sequence in utf-8?
type.is_valid_utf8_first_byte(byte u8) => bool[Inherited from String]¶[src]
is byte a valid starting byte of a utf-8 string?
type.join(elems Sequence String) => String[Inherited from String]¶[src]
Takes a sequence of strings and concatenates its elements.
In case an empty sequence is given, returns the empty string.
In case an empty sequence is given, returns the empty string.
type.join(elems Sequence String,sep String) => String[Inherited from String]¶[src]
Takes a sequence of strings and concatenates its elements, while adding the separator
sep in between its elements. In case an empty sequence is given, returns the empty string.
sep in between its elements. In case an empty sequence is given, returns the empty string.
type.join_lines(elems Sequence String) => String[Inherited from String]¶[src]
Takes a sequence of strings and concatenates its elements, while adding the separator
\n in between its elements. In case an empty sequence is given, returns the empty string.
\n in between its elements. In case an empty sequence is given, returns the empty string.
type.lteq(a property.partially_orderable.this,b property.partially_orderable.this) => bool[Inherited from partially_orderable][Abstract feature]¶[src]
does a come before b or is equal to b?
type.name => String[Inherited from Type]¶[src]
name of this type, including type parameters, e.g. 'option (list i32)'.
type.prefix $ => String[Inherited from Type]¶[src]
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
type.type_value => Type[Inherited from Any]¶[src]
Get a type as a value.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
Applicable universe features
These are features in universe, that have an argument with a type constraint that matches this features type and can therefore be used with it.
equals(T:property.equatable,a T,b T) => bool¶[src]
equals -- feature that compares two values using the equality relation
defined in their type
defined in their type
hash(T:property.hashable,a T) => u64¶[src]
hash of a value
infix !=(T:property.equatable,a T,b T) => bool¶[src]
infix = -- infix operation as shorthand for 'equals'
infix <(T:property.orderable,a T,b T) => bool¶[src]
does this come strictly before other?
infix <=(T:property.partially_orderable,a T,b T) => bool¶[src]
infix <= -- infix operation as shorthand for 'lteq'
infix <>(T:property.orderable,a T,b T) => order¶[src]
three-way comparison between this and other.
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
infix =(T:property.equatable,a T,b T) => bool¶[src]
infix = -- infix operation as shorthand for 'equals'
infix >(T:property.orderable,a T,b T) => bool¶[src]
does this come strictly after other?
infix >=(T:property.orderable,a T,b T) => bool¶[src]
does this come after other?
infix ∈(T:property.equatable,a T,s container.Set T) => bool¶[src]
is `a` contained in `Set` `s`?
This should usually be called using type inference as in
This should usually be called using type inference as in
infix ∉(T:property.equatable,a T,s container.Set T) => bool¶[src]
is `a` not contained in `Set` `s`?
This should usually be called using type inference as in
This should usually be called using type inference as in
infix ≤(T:property.partially_orderable,a T,b T) => bool¶[src]
infix ≤ -- infix operation as shorthand for 'lteq'
infix ≥(T:property.orderable,a T,b T) => bool¶[src]
does this come after other?
infix ⋄(T:property.orderable,a T,b T) => order¶[src]
three-way comparison between this and other.
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
lteq(T:property.partially_orderable,a T,b T) => bool¶[src]
lteq -- feature that compares two values using the lteq relation
defined in their type
defined in their type
max(T:property.orderable,a T,b T) => T¶[src]
maximum of two values
memoize(MM:container.Mutable_Map T R,T:property.equatable,R:Any,f Unary R T) => Unary R T¶[src]
memoize `f`.
wraps f so that f will only be called once for every unique input.
The term "memoization" was coined by Donald Michie in 1968 and
is derived from the Latin word "memorandum" ("to be remembered"),
usually truncated as "memo" in American English, and thus carries
the meaning of "turning a function into something to be remembered".
https://en.wikipedia.org/wiki/Memoization
example:
wraps f so that f will only be called once for every unique input.
The term "memoization" was coined by Donald Michie in 1968 and
is derived from the Latin word "memorandum" ("to be remembered"),
usually truncated as "memo" in American English, and thus carries
the meaning of "turning a function into something to be remembered".
https://en.wikipedia.org/wiki/Memoization
example:
min(T:property.orderable,a T,b T) => T¶[src]
minimum of two values
0.099dev (GIT hash 20ecdcd8d62a0489c977cbb7295b8b8b142ee53e)