Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/shioruby.rb

Overview

convenient for SHIORI Request treatment

Instance Method Summary collapse

Instance Method Details

#separated(separator = "\x01") ⇒ Array<String>

split \x01 separated Reference* value like “arg1\x01arg2\x01arg3” into Array

Parameters:

  • separator (String) (defaults to: "\x01")

    separator

Returns:



67
68
69
# File 'lib/shioruby.rb', line 67

def separated(separator = "\x01")
  self.split(separator)
end

#separated2(separator1 = "\x02", separator2 = "\x01") ⇒ Array<Array<String>>

split \x01, \x02 separated Reference* value like “arg1-1\x01arg1-2\x02arg2-1\x01arg2-2” into Array of Array

Parameters:

  • separator1 (String) (defaults to: "\x02")

    1st level separator

  • separator2 (String) (defaults to: "\x01")

    2nd level separator

Returns:



75
76
77
# File 'lib/shioruby.rb', line 75

def separated2(separator1 = "\x02", separator2 = "\x01")
  self.split(separator1).map {|element| element.split(separator2)}
end