Method: U::String#partition

Defined in:
ext/u/rb_u_string_partition.c

#partition(separator) ⇒ Array<U::String>

Returns The receiver split into s₁ = #slice(0, i), s₂ = #slice(i, n), s₃ = #slice(i+n, -1), where i

j if j ≠ nil, i = #length otherwise, j =

#index(SEPARATOR), n = SEPARATOR#length, where s₁ and s₃ inherit any taint and untrust from the receiver and s₂ inherits any taint and untrust from SEPARATOR and also from the receiver if SEPARATOR is a Regexp.

Parameters:

Returns:

  • (Array<U::String>)

    The receiver split into s₁ = #slice(0, i), s₂ = #slice(i, n), s₃ = #slice(i+n, -1), where i

    j if j ≠ nil, i = #length otherwise, j =

    #index(SEPARATOR), n = SEPARATOR#length, where s₁ and s₃ inherit any taint and untrust from the receiver and s₂ inherits any taint and untrust from SEPARATOR and also from the receiver if SEPARATOR is a Regexp

See Also:



73
74
75
76
77
78
79
80
# File 'ext/u/rb_u_string_partition.c', line 73

VALUE
rb_u_string_partition(VALUE self, VALUE separator)
{
        if (TYPE(separator) == T_REGEXP)
                return rb_u_string_partition_regex(self, separator);

        return rb_u_string_partition_string(self, separator);
}