Method: String#substring

Defined in:
lib/commons/ruby/string.rb

#substring(begin_index, end_index = nil) ⇒ Object

java.lang.String#substring (Java-like signature)



37
38
39
40
41
42
43
# File 'lib/commons/ruby/string.rb', line 37

def substring(begin_index, end_index = nil)
  if end_index == nil
    return self[begin_index .. -1]
  else
    return self[begin_index ... end_index]
  end
end