Sha256: 900516dff4e01fcd83f8a5ab1fdcbaafd19eba3ca58c0fcc0f28b1cd56475e56

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# = String
#
#--
# Ruby version 1.8
#
# == Authors
# * Yomei Komiya
# 
# == Copyright
# 2008 the original author or authors.
#
# == License
# Apache License 2.0
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#  http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#++
# == Version
# SVN: $Id: string.rb 77 2008-10-12 12:07:49Z whitestar $
#
# == Since
# File available since Release 0.8.0

require 'facets/string'

class String
  # java.lang.String#substring (Java-like signature)
  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
  
  
  # java.lang.String#replaceAll (Java-like signature)
  def replace_all(pattern, replace)
    result = self.gsub(pattern, replace)
    if result == nil
      return self
    else
      return result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rcommons-0.8.0 lib/commons/ruby/string.rb