Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

infix *

String.infix *

repeat string given number of times

Reference Constructors

§(n i32)
 ref
:
String
 is
 
[Inherited from  String]
repeat string given number of times

Functions

convert this string into a Sequence of codepoint and errors for encoding problems
found in the underlying utf8 bytes
§
:
Any
 => 
String 
[Inherited from  String]
converting a string to a string is just returning string.this

redefines:

§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
98
99
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
76..89
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
i32 
[Inherited from  String]
length of this string in bytes
§
:
Any
 => 
i32 
[Inherited from  String]
length of this string in codepoints
convert this string into a list of codepoint and errors for encoding problems
found in the underlying utf8 bytes
§(substring String)
:
Any
 => 
bool 
[Inherited from  String]
does this string contain the given 'substring'
§
:
Any
 => 
bool 
[Inherited from  String]
returns true if string contains whitespace
§(substring String)
:
Any
 => 
i32 
[Inherited from  String]
count number of occurrences of given 'substring' in this string
§
:
Any
 => 
String 
[Inherited from  String]
NYI: string.reverse causes a conflict with Const_String.reverse since visibility is not supported
public string.reverse => terminal.reverse + string.this + terminal.reset
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 appreance 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.
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
Type 
[Inherited from  Any]
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.
§
:
Any
 => 
String 
[Inherited from  String]
§(suffix String)
:
Any
 => 
bool 
[Inherited from  String]
check if this string ends with given suffix
Splits this string at codepoints where p is true and returns the result as a
list of strings. In case multiple, neighboring codepoints in the string are
evaluated to be true by p, this does not cause empty strings to be added to
the result list, rather this case is being treated as being one big separator.
§(substring String)
:
Any
 => 
option i32 
[Inherited from  String]
find (utf8-byte-) index of 'substring' witin this string.
§(substring String, from i32)
:
Any
 => 
option i32 
[Inherited from  String]
find (utf8-byte-) index of 'substring' witin this string.
§(substring String)
:
Any
 => 
option i32 
[Inherited from  String]
find (utf8-byte-) index of last occurrence of 'substring'
within this string.
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§(other Any)
:
Any
 => 
String 
[Inherited from  String]
concatenate string with string representation of another object
§
:
Any
 => 
bool 
[Inherited from  String]
Does this String consist of nothing but ascii codepoints?
§
:
Any
 => 
bool 
[Inherited from  String]
returns true if string is empty or contains whitespace only
§
:
Any
 => 
bool 
[Inherited from  String]
is this string empty?
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
convert this string to lower case
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§(n i32)
:
Any
 => 
String 
[Inherited from  String]
pad this string at the end with spaces such that its `codepoint_length` is at least `n`.
§(p String, n i32)
:
Any
 => 
String 
[Inherited from  String]
pad this string at the end with `p` such that its `codepoint_length` is at least `n`.
§(n i32)
:
Any
 => 
String 
[Inherited from  String]
pad this string at the beginning and at the end with spaces such that its `codepoint_length` is at least `n`.

In case the required number of codepoints to add is odd, the padding at the end will be longer.
§(p String, n i32)
:
Any
 => 
String 
[Inherited from  String]
pad this string at the beginning and at the end with `p` such that its `codepoint_length` is at least `n`.

In case the required number of copies of `p` is odd, the padding at the end will be longer.
§(l i32, s String)
:
Any
 => 
String 
[Inherited from  String]
return string of at least length l by
padding codepoint s to start of string
§(n i32)
:
Any
 => 
String 
[Inherited from  String]
pad this string at the beginning with spaces such that its `codepoint_length` is at least `n`.
§(p String, n i32)
:
Any
 => 
String 
[Inherited from  String]
pad this string at the beginning with `p` such that its `codepoint_length` is at least `n`.
§
:
Any
 => 
outcome i32 
[Inherited from  String]
parse this string as a signed 32-bit integer value
§(base i32)
:
Any
 => 
outcome i32 
[Inherited from  String]
§
:
Any
 => 
outcome i32 
[Inherited from  String]
§
:
Any
 => 
outcome i64 
[Inherited from  String]
parse this string as a signed 64-bit integer value
§(base i64)
:
Any
 => 
outcome i64 
[Inherited from  String]
§
:
Any
 => 
outcome i64 
[Inherited from  String]
§
:
Any
 => 
outcome int 
[Inherited from  String]
parse this string as an int value of arbitrary size
§(base int)
:
Any
 => 
outcome int 
[Inherited from  String]
§
:
Any
 => 
outcome int 
[Inherited from  String]
§(T 
type
, base String.parse_integer.T)
:
Any
 => 
outcome String.parse_integer.T 
[Inherited from  String]
parse this string as a integer value given as type parameter
§
:
Any
 => 
outcome u32 
[Inherited from  String]
parse this string as an unsigned 32-bit integer value
§(base u32)
:
Any
 => 
outcome u32 
[Inherited from  String]
§
:
Any
 => 
outcome u32 
[Inherited from  String]
§
:
Any
 => 
outcome u64 
[Inherited from  String]
parse this string as an unsigned 64-bit integer value
§(base u64)
:
Any
 => 
outcome u64 
[Inherited from  String]
§
:
Any
 => 
outcome u64 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  Any]
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.
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§(old String, new String)
:
Any
 => 
String 
[Inherited from  String]
replace all occurrences of old by new
§(old String, new String, n u64)
:
Any
 => 
String 
[Inherited from  String]
replace the first n occurrences of old by new
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
57
56
§
:
Any
 => 
list String 
[Inherited from  String]
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.
§(s String)
:
Any
 => 
list String 
[Inherited from  String]
split string at s
§(s String)
:
Any
 => 
list String 
[Inherited from  String]
split string after s, that is do the same thing as split but
include the separator s in the resulting strings
§(s String, n u32)
:
Any
 => 
list String 
[Inherited from  String]
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
§(s String, n u32)
:
Any
 => 
list String 
[Inherited from  String]
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
§(prefx String)
:
Any
 => 
bool 
[Inherited from  String]
check if this string starts with given prefix
§
:
Any
 => 
String 
[Inherited from  String]
§(from i32)
:
Any
 => 
String 
[Inherited from  String]
create substring of this string consisting of bytes from (inclusive) .. byte_length (exclusive).
§(from i32, to i32)
:
Any
 => 
String 
[Inherited from  String]
create substring of this string consisting of bytes from (inclusive) .. to (exclusive).
§(from i32)
:
Any
 => 
String 
[Inherited from  String]
create substring of this string consisting of codepoints from (inclusive) .. codepoint_length (exclusive).
§(from i32, to i32)
:
Any
 => 
String 
[Inherited from  String]
create substring of this string consisting of codepoints from (inclusive) .. to (exclusive).
§
:
Any
 => 
String 
[Inherited from  String]
66..72
§
:
Any
 => 
String 
[Inherited from  String]
remove leading and trailing white space from this string
§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]
convert this string to upper case
§
:
Any
 => 
Sequence u8 
[Redefinition of String.utf8]

redefines:

§
:
Any
 => 
String 
[Inherited from  String]
§
:
Any
 => 
String 
[Inherited from  String]

Reference Types

§
 ref
:
String
 is
 
[Inherited from  String]
repeat string given number of times

Value Types

§
:
Any
 is
 
[Inherited from  String]
helper type for the result of the cut feature

Type Features

§
:
Any
 is
 
[Inherited from  String]
§
:
Any
 is
 
[Inherited from  Type]
string representation of this type to be used for debugging.

result has the form "Type of '<name>'", but this might change in the future

redefines:

§
:
Any
 is
 
[Inherited from  String]
§
:
Any
 is
 
[Inherited from  String]
§
:
Monoid String
 is
 
[Inherited from  String]
monoid of strings with infix + operation.
§(a String, b String)
:
Any
 is
 
[Inherited from  String]
concat strings a and b by
concatenating their byte sequences.
§(sep String)
:
Monoid String
 is
 
[Inherited from  String]
monoid of strings with infix '+ sep +' operation, i.e., concatenate with
given separator
§
:
Any
 is
 
[Inherited from  Type]
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.

redefines:

§(a property.equatable.this.type, b property.equatable.this.type)
:
Any
 is
 
[Inherited from  equatable]
 
[Abstract feature]
equality implements the default equality relation for values of this type.

This relation must be

- reflexive (equality a b),
- 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'.
§(utf8_bytes Sequence u8)
:
Any
 is
 
[Inherited from  String]
create string from the given utf8 bytes
§(codepoints Sequence codepoint)
:
Any
 is
 
[Inherited from  String]
create string from the given codepoints
create string by concatenating the results of $a[a.indices].

This uses a growing array if further strings are appended using 'infix +',
so it avoids quadratic runtime caused if each 'infix +' would create its
own concatenation-string.

The performance of creating a string a0+a1+a2+...+a<n> is in O(n) since the
backing array is shared and doubled in size when full (so the final array size
is less than 2n in size and the sum of all arrays is less than 4n = 2n + n +
n/2+n/4+...).

The performance of iterating the utf8 bytes of a string is O(l+n) for an
array of length l created by concatenating n sub-strings.
§(a String.this.type)
:
Any
 is
 
[Inherited from  String]
create hash code from a string
§(T 
type
)
:
Any
 is
 
[Inherited from  Type]
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.

is_of_integer_type(n T : numeric) => T : integer
say (is_of_integer_type 1234) # true
say (is_of_integer_type 3.14) # false

it is most useful in conjunction preconditions or `if` statements as in

pair(a,b T) is

=>

or

val(n T) is

§(elems Sequence String)
:
Any
 is
 
[Inherited from  String]
Takes a sequence of strings and concatenates its elements.
In case an empty sequence is given, returns the empty string.
§(elems Sequence String, sep String)
:
Any
 is
 
[Inherited from  String]
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.
§(a property.partially_orderable.this.type, b property.partially_orderable.this.type)
:
Any
 is
 
[Inherited from  partially_orderable]
 
[Abstract feature]
does a come before b or is equal to b?
§
:
Any
 is
 
[Inherited from  String]
NYI: remove the convenience functions when Fuzion supports char literals
§
:
Any
 is
 
[Inherited from  Type]
name of this type, including type parameters, e.g. 'option (list i32)'.
§
:
Any
 is
 
[Inherited from  String]
§
:
Any
 is
 
[Inherited from  String]
§
:
Any
 is
 
[Inherited from  Any]
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`.
§
:
Any
 is
 
[Inherited from  String]
§
:
Any
 is
 
[Inherited from  String]
last changed: 2024-09-18