Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
»

codepoint

codepoint

codepoint -- represents a unicode codepoint

Fields

Constructors

:
Any
 is
[Inherited from  String]
[Contains abstract features]
[Private constructor]
helper type for the result of the cut feature
(n i32)
 ref
:
String
 is
[Inherited from  String]
repeat string given number of times

Functions

 => 
array u8
[Inherited from  String]
[Contains abstract features]
returns a zero terminated array of
the bytes of this String
 => 
Sequence codepoint
[Inherited from  String]
[Contains abstract features]
convert this string into a Sequence of codepoint and errors for encoding problems
found in the underlying utf8 bytes
 => 
fuzion.java.Java_Object
[Inherited from  String]
[Contains abstract features]
 => 
String
[Inherited from  String]
[Contains abstract features]
converting a string to a string is just returning string.this

redefines:

 => 
i32
[Inherited from  String]
[Contains abstract features]
length of this string in bytes
(n i32)
 => 
Sequence String
[Inherited from  String]
[Contains abstract features]
splits this string in chunks of codepoint length n, the last part might be shorter
 => 
i32
[Inherited from  String]
[Contains abstract features]
length of this string in codepoints
 => 
list (outcome codepoint)
[Inherited from  String]
[Contains abstract features]
convert this string into a list of codepoint and errors for encoding problems
found in the underlying utf8 bytes
(substring String)
 => 
bool
[Inherited from  String]
[Contains abstract features]
does this string contain the given 'substring'
 => 
bool
[Inherited from  String]
[Contains abstract features]
returns true if string contains whitespace
(substring String)
 => 
i32
[Inherited from  String]
[Contains abstract features]
count number of occurrences of given 'substring' in this string
(sep String)
 => 
String.this.cut_result
[Inherited from  String]
[Contains abstract features]
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.
 => 
Type
[Inherited from  Any]
[Contains abstract features]
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.
(suffix String)
 => 
bool
[Inherited from  String]
[Contains abstract features]
check if this string ends with given suffix
(p Unary bool codepoint)
 => 
Sequence String
[Inherited from  String]
[Contains abstract features]
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)
 => 
option i32
[Inherited from  String]
[Contains abstract features]
find (utf8-byte-) index of 'substring' within this string.
(substring String, from i32)
 => 
option i32
[Inherited from  String]
[Contains abstract features]
find (utf8-byte-) index of 'substring' within this string.
(substring String)
 => 
option i32
[Inherited from  String]
[Contains abstract features]
find (utf8-byte-) index of last occurrence of 'substring'
within this string.
(other Any)
 => 
String
[Inherited from  String]
[Contains abstract features]
concatenate string with string representation of another object
 => 
bool
[Redefinition of  String.is_ascii]
[Contains abstract features]
is this an ASCII code encoded in one byte

redefines:

 => 
bool
[Contains abstract features]
is this an ASCII digit i.e. 0-9
 => 
bool
[Contains abstract features]
is this an ASCII letter i.e. A-Z or a-z
 => 
bool
[Inherited from  String]
[Contains abstract features]
returns true if string is empty or contains whitespace only
 => 
bool
[Inherited from  String]
[Contains abstract features]
is this string empty?
 => 
bool
[Contains abstract features]
is this a lowercase ASCII letter i.e. a-z
 => 
bool
[Contains abstract features]
is this codepoint guaranteed to never be a legal unicode character
 => 
bool
[Contains abstract features]
is this an uppercase ASCII letter i.e. A-Z
 => 
bool
[Contains abstract features]
is this a codepoint reserved for utf16 surrogate pairs
 => 
list String
[Inherited from  String]
[Contains abstract features]
split string at line feeds
 => 
String
[Inherited from  String]
[Contains abstract features]
convert this string to lower case
(n i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
pad this string at the end with spaces such that its `codepoint_length` is at least `n`.
(p String, n i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
pad this string at the end with `p` such that its `codepoint_length` is at least `n`.
(n i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
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)
 => 
String
[Inherited from  String]
[Contains abstract features]
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)
 => 
String
[Inherited from  String]
[Contains abstract features]
return string of at least length l by
padding codepoint s to start of string
(n i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
pad this string at the beginning with spaces such that its `codepoint_length` is at least `n`.
(p String, n i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
pad this string at the beginning with `p` such that its `codepoint_length` is at least `n`.
 => 
outcome i128
[Inherited from  String]
[Contains abstract features]
parse this string as a signed 128-bit integer value
(base u64)
 => 
outcome i128
[Inherited from  String]
[Contains abstract features]
 => 
outcome i128
[Inherited from  String]
[Contains abstract features]
 => 
outcome i128
[Inherited from  String]
[Contains abstract features]
 => 
outcome i128
[Inherited from  String]
[Contains abstract features]
 => 
outcome i32
[Inherited from  String]
[Contains abstract features]
parse this string as a signed 32-bit integer value
(base i32)
 => 
outcome i32
[Inherited from  String]
[Contains abstract features]
 => 
outcome i32
[Inherited from  String]
[Contains abstract features]
 => 
outcome i32
[Inherited from  String]
[Contains abstract features]
 => 
outcome i32
[Inherited from  String]
[Contains abstract features]
 => 
outcome i64
[Inherited from  String]
[Contains abstract features]
parse this string as a signed 64-bit integer value
(base i64)
 => 
outcome i64
[Inherited from  String]
[Contains abstract features]
 => 
outcome i64
[Inherited from  String]
[Contains abstract features]
 => 
outcome i64
[Inherited from  String]
[Contains abstract features]
 => 
outcome i64
[Inherited from  String]
[Contains abstract features]
 => 
outcome int
[Inherited from  String]
[Contains abstract features]
parse this string as an int value of arbitrary size
(base int)
 => 
outcome int
[Inherited from  String]
[Contains abstract features]
 => 
outcome int
[Inherited from  String]
[Contains abstract features]
 => 
outcome int
[Inherited from  String]
[Contains abstract features]
 => 
outcome int
[Inherited from  String]
[Contains abstract features]
(T 
type
:
integer, base T)
 => 
outcome T
[Inherited from  String]
[Contains abstract features]
parse this string as a integer value given as type parameter
 => 
outcome u128
[Inherited from  String]
[Contains abstract features]
parse this string as an unsigned 128-bit integer value
(base u64)
 => 
outcome u128
[Inherited from  String]
[Contains abstract features]
 => 
outcome u128
[Inherited from  String]
[Contains abstract features]
 => 
outcome u128
[Inherited from  String]
[Contains abstract features]
 => 
outcome u128
[Inherited from  String]
[Contains abstract features]
 => 
outcome u32
[Inherited from  String]
[Contains abstract features]
parse this string as an unsigned 32-bit integer value
(base u32)
 => 
outcome u32
[Inherited from  String]
[Contains abstract features]
 => 
outcome u32
[Inherited from  String]
[Contains abstract features]
 => 
outcome u32
[Inherited from  String]
[Contains abstract features]
 => 
outcome u32
[Inherited from  String]
[Contains abstract features]
 => 
outcome u64
[Inherited from  String]
[Contains abstract features]
parse this string as an unsigned 64-bit integer value
(base u64)
 => 
outcome u64
[Inherited from  String]
[Contains abstract features]
 => 
outcome u64
[Inherited from  String]
[Contains abstract features]
 => 
outcome u64
[Inherited from  String]
[Contains abstract features]
 => 
outcome u64
[Inherited from  String]
[Contains abstract features]
 => 
String
[Inherited from  Any]
[Contains abstract features]
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.
(old String, new String)
 => 
String
[Inherited from  String]
[Contains abstract features]
replace all occurrences of old by new
(old String, new String, n u64)
 => 
String
[Inherited from  String]
[Contains abstract features]
replace the first n occurrences of old by new
 => 
list String
[Inherited from  String]
[Contains abstract features]
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)
 => 
list String
[Inherited from  String]
[Contains abstract features]
split string at s
(s String)
 => 
list String
[Inherited from  String]
[Contains abstract features]
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)
 => 
list String
[Inherited from  String]
[Contains abstract features]
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)
 => 
list String
[Inherited from  String]
[Contains abstract features]
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)
 => 
bool
[Inherited from  String]
[Contains abstract features]
check if this string starts with given prefix
(from i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
create substring of this string consisting of bytes from (inclusive) .. byte_length (exclusive).
(from i32, to i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
create substring of this string consisting of bytes from (inclusive) .. to (exclusive).
(from i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
create substring of this string consisting of codepoints from (inclusive) .. codepoint_length (exclusive).
(from i32, to i32)
 => 
String
[Inherited from  String]
[Contains abstract features]
create substring of this string consisting of codepoints from (inclusive) .. to (exclusive).
 => 
String
[Inherited from  String]
[Contains abstract features]
remove leading and trailing white space from this string
 => 
String
[Inherited from  String]
[Contains abstract features]
remove trailing white space from this string
 => 
String
[Inherited from  String]
[Contains abstract features]
remove leading white space from this string
 => 
String
[Inherited from  String]
[Contains abstract features]
convert this string to upper case
 => 
Sequence u8
[Redefinition of  String.utf8]
[Contains abstract features]
the utf8 encoded bytes for the string representation
of this codepoint

redefines:

(LM 
type
:
mutate)
 => 
(io.buffered String.write_to.LM).writer.write_result
[Inherited from  String]
[Contains abstract features]
write the bytes of this String to
writer of type: (io.buffered LM).writer

Type Functions

 => 
u8
[Inherited from  String]
[Contains abstract features]
 => 
interval u32
[Contains abstract features]
A to Z (uppercase only)
 => 
interval u32
[Contains abstract features]
a to z (lowercase only)
 => 
String
[Inherited from  Type]
[Contains abstract features]
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:

 => 
interval u32
[Contains abstract features]
range of values encoded in one byte
 => 
interval u32
[Contains abstract features]
0 to 9
 => 
u8
[Inherited from  String]
[Contains abstract features]
 => 
u8
[Inherited from  String]
[Contains abstract features]
 => 
Monoid String
[Inherited from  String]
[Contains abstract features]
monoid of strings with infix + operation.
(sep String)
 => 
Monoid String
[Inherited from  String]
[Contains abstract features]
monoid of strings with infix '+ sep +' operation, i.e., concatenate with
given separator
(a String, b String)
 => 
String
[Inherited from  String]
[Contains abstract features]
concat strings a and b by
concatenating their byte sequences.
 => 
Type
[Inherited from  Type]
[Contains abstract features]
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 codepoint, b codepoint)
 => 
bool
[Contains abstract features]
compare two codepoints for equality

result is true iff the codepoints have the same value
(utf8_bytes Sequence u8)
 => 
String
[Inherited from  String]
[Contains abstract features]
create string from the given utf8 bytes
(codepoints Sequence codepoint)
 => 
String
[Inherited from  String]
[Contains abstract features]
create string from the given codepoints
(E 
type
:
mutate, a container.Mutable_Array Any E)
 => 
String
[Inherited from  String]
[Contains abstract features]
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)
 => 
u64
[Inherited from  String]
[Contains abstract features]
create hash code from a string
(T 
type
)
 => 
bool
[Inherited from  Type]
[Contains abstract features]
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
same
pre T : property.equatable
=>
a = b

or

val(n T) is

# check if T is numeric, if so
# return true if n > zero,
# return nil if T is not numeric
#
more_than_zero option bool =>
if T : numeric then
n > T.zero
else
nil
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(elems Sequence String)
 => 
String
[Inherited from  String]
[Contains abstract features]
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)
 => 
String
[Inherited from  String]
[Contains abstract features]
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.
 => 
container.Set u32
[Contains abstract features]
a-z and A-Z
https://en.wikipedia.org/wiki/ISO_basic_Latin_alphabet
(a codepoint, b codepoint)
 => 
bool
[Contains abstract features]
compare two codepoints

This defines a total order over strings that is unrelated to alphabetic order.
 => 
u8
[Inherited from  String]
[Contains abstract features]
NYI: remove the convenience functions when Fuzion supports char literals
 => 
String
[Inherited from  Type]
[Contains abstract features]
name of this type, including type parameters, e.g. 'option (list i32)'.
 => 
u8
[Inherited from  String]
[Contains abstract features]
 => 
interval u32
[Contains abstract features]
values guaranteed never to be a legal unicode character
 => 
u8
[Inherited from  String]
[Contains abstract features]
 => 
String
[Inherited from  Type]
[Contains abstract features]
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

redefines:

 => 
interval u32
[Contains abstract features]
range of permitted value for a codepoint
 => 
Type
[Inherited from  Any]
[Contains abstract features]
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`.
 => 
interval u32
[Contains abstract features]
range reserved for utf16 surrogate pairs
 => 
interval u32
[Contains abstract features]
range of values encoded in four bytes
 => 
interval u32
[Contains abstract features]
range of values encoded in one byte
range of values encoded in three bytes
 => 
interval u32
[Contains abstract features]
range of values encoded in two bytes
 => 
u8
[Inherited from  String]
[Contains abstract features]
 => 
u8
[Inherited from  String]
[Contains abstract features]
0.094dev (2025-06-18 15:08:51 GIT hash 89cffc23ae669b0898a5564fefbf793fcb8e5ca7 built by fridi@fzen)