module Allegro::UString

Overview

This module define methods for any type of AnyUStrings

Note that UString is not mutable.

Included Modules

Direct including types

Defined in:

Class Method Summary

Instance Method Summary

Class Method Detail

def self.build(&) #

Similar to String.build that generates Allegro::AllocatedUString


def self.from_utf16(slice : Slice(UInt16)) : AllocatedUString #

Generates AllocatedUString from Slice containing UTF-16


Instance Method Detail

def <=>(str : String) #

def <=>(str : AnyUString) #
Description copied from module Comparable(Allegro::AllocatedUString | Allegro::EmptyUString | Allegro::StaticUString)

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]

def ==(str : String) #

def ==(str : AnyUString) #
Description copied from module Comparable(Allegro::AllocatedUString | Allegro::EmptyUString | Allegro::StaticUString)

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.


def =~(regex : Regex) #

def [](range : Range) : AllocatedUString #

def [](index : Int32) : Char #

def [](start : Int, count : Int) : AllocatedUString #

def []?(start : Int, count : Int) : AllocatedUString? #

def []?(index : Int32) : Char? #

def []?(range : Range) : AllocatedUString? #

def byte_at(index, &) #

def byte_at(index) #

def byte_at?(index) #

def byte_index(byte : Int, offset = 0) : Int32? #

def bytes #

def bytesize #

def dup : AllocatedUString #

Duplicate the string


def size #

def to_s #

Converts to String


def to_s(io : IO) #

def to_slice(size : Int = self.bytesize, *, copy = true) #

Make byte Slice contains the data


def to_utf16 #

Make a slice of UTF-16 string