module Allegro::UString
Overview
This module define methods for any type of AnyUString
s
Note that UString is not mutable.
Included Modules
- Comparable(Allegro::AllocatedUString | Allegro::EmptyUString | Allegro::StaticUString)
- Comparable(String)
Direct including types
Defined in:
Class Method Summary
-
.build(&)
Similar to
String.build
that generates Allegro::AllocatedUString -
.from_utf16(slice : Slice(UInt16)) : AllocatedUString
Generates
AllocatedUString
from Slice containing UTF-16
Instance Method Summary
- #<=>(str : String)
-
#<=>(str : AnyUString)
The comparison operator.
- #==(str : String)
-
#==(str : AnyUString)
Compares this object to other based on the receiver’s
#<=>
method, returningtrue
if it returns0
. - #=~(regex : Regex)
- #[](range : Range) : AllocatedUString
- #[](index : Int32) : Char
- #[](start : Int, count : Int) : AllocatedUString
- #[]?(start : Int, count : Int) : AllocatedUString?
- #[]?(index : Int32) : Char?
- #[]?(range : Range) : AllocatedUString?
- #byte_at(index, &)
- #byte_at(index)
- #byte_at?(index)
- #byte_index(byte : Int, offset = 0) : Int32?
- #bytes
- #bytesize
-
#dup : AllocatedUString
Duplicate the string
- #size
-
#to_s
Converts to String
- #to_s(io : IO)
-
#to_slice(size : Int = self.bytesize, *, copy = true)
Make byte
Slice
contains the data -
#to_utf16
Make a slice of UTF-16 string
Class Method Detail
Generates AllocatedUString
from Slice containing UTF-16
Instance Method Detail
The comparison operator. Returns 0
if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greter than other,
or nil
if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
Compares this object to other based on the receiver’s #<=>
method,
returning true
if it returns 0
.
Also returns true
if this and other are the same object.