Method: Filex::Filex.colon_space

Defined in:
lib/filex.rb

.colon_space(str) ⇒ Array<String>

最初に現れる「:」と空白文字の組み合わせを区切り文字列として、文字列を2つに分割する

Parameters:

  • str (String)

    分割対象文字列

Returns:

  • (Array<String>)

    第0要素 分割文字列の左側部分、第1要素 分割文字列の右側部分



175
176
177
178
179
180
181
182
# File 'lib/filex.rb', line 175

def self.colon_space(str)
  if (m = /^(\s*([^\s]+):\s)(.*)$/.match(str))
    left = m[1]
    right = m[3]
  end

  [left, right]
end