class

Crystal::Macros::SymbolLiteral

Inherits Crystal::Macros::ASTNode

A symbol literal.

Instance methods

+(other : StringLiteral | CharLiteral) : SymbolLiteral

Similar to String#+.

Source
=~(range : RegexLiteral) : BoolLiteral

Similar to String#matches?.

Source
[](range : RangeLiteral) : SymbolLiteral

Similar to String#[].

Source
camelcase(*, lower : BoolLiteral = false) : SymbolLiteral

Similar to String#camelcase.

Source
capitalize

Similar to String#capitalize.

Source
chars

Similar to String#chars.

Source
chomp

Similar to String#chomp.

Source
count(other : CharLiteral) : NumberLiteral

Similar to String#count.

Source
downcase

Similar to String#downcase.

Source
empty?

Similar to String#empty?.

Source
ends_with?(other : StringLiteral | CharLiteral) : BoolLiteral

Similar to String#ends_with?.

Source
gsub(regex : RegexLiteral, & : StringLiteral, ArrayLiteral(StringLiteral | NilLiteral) -> _) : SymbolLiteral

Similar to String#gsub(pattern, options, &).

NOTE: The special variables $~ and $1, $2, ... are not supported.

Source
gsub(regex : RegexLiteral, replacement : StringLiteral) : SymbolLiteral

Similar to String#gsub.

Source
id

Returns a MacroId for this string's contents.

Source
includes?(search : StringLiteral | CharLiteral) : BoolLiteral

Similar to String#includes?.

Source
lines

Similar to String#lines.

Source
match(regex : RegexLiteral) : HashLiteral(NumberLiteral | StringLiteral, StringLiteral | NilLiteral)

Matches the given regex against this string and returns a capture hash, or nil if a match cannot be found.

The capture hash has the same form as Regex::MatchData#to_h.

Source
scan(regex : RegexLiteral) : ArrayLiteral(HashLiteral(NumberLiteral | StringLiteral, StringLiteral | NilLiteral))

Returns an array of capture hashes for each match of regex in this string.

Capture hashes have the same form as Regex::MatchData#to_h.

Source
size

Similar to String#size.

Source
split(node : StringLiteral) : ArrayLiteral(StringLiteral)

Similar to String#split(String).

Source
split(node : CharLiteral) : ArrayLiteral(StringLiteral)

Similar to String#split(Char).

Source
split(node : ASTNode) : ArrayLiteral(StringLiteral)

Similar to String#split(String).

Source
split(node : RegexLiteral) : ArrayLiteral(StringLiteral)

Similar to String#split(Regex).

Source
split

Similar to String#split().

Source
starts_with?(other : StringLiteral | CharLiteral) : BoolLiteral

Similar to String#starts_with?.

Source
strip

Similar to String#strip.

Source
titleize

Similar to String#titleize.

Source
to_i(base = 10)

Similar to String#to_i.

Source
to_utf16

Returns an expression that evaluates to a slice literal containing the UTF-16 code units of this string, plus an extra trailing null character. This null character is not part of the slice, but ensures that calling #to_unsafe always results in a properly null-terminated C string.

(::Slice(::UInt16).literal(97_u16, 98_u16, 99_u16, 55357_u16, 56834_u16, 0_u16))[0, 5] # => ::Slice(::UInt16).literal(97, 98, 99, 55357, 56834, 0)[0, 5]

WARNING: The return value is not necessarily a literal node.

Source
tr(from : StringLiteral, to : StringLiteral) : SymbolLiteral

Similar to String#tr.

Source
underscore

Similar to String#underscore.

Source
upcase

Similar to String#upcase.

Source