Change String.subSequence parameter names to match those of CharSequence.subSequence.

This commit is contained in:
Ilya Gorbunov
2016-03-31 23:19:27 +03:00
parent c64b59ed82
commit f3f1aa8a15
3 changed files with 29 additions and 3 deletions
@@ -1,3 +1,19 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* 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.
*/
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
@@ -286,6 +302,16 @@ public fun String.substring(range: IntRange): String = substring(range.start, ra
*/
public fun CharSequence.subSequence(range: IntRange): CharSequence = subSequence(range.start, range.endInclusive + 1)
/**
* Returns a subsequence of this char sequence.
*
* This extension is chosen only for invocation with old-named parameters.
* Replace parameter names with the same as those of [CharSequence.subSequence].
*/
@kotlin.internal.InlineOnly
@Deprecated("Use parameters named startIndex and endIndex.", ReplaceWith("subSequence(startIndex = start, endIndex = end)"))
public inline fun String.subSequence(start: Int, end: Int): CharSequence = subSequence(start, end)
/**
* Returns a substring of chars from a range of this char sequence starting at the [startIndex] and ending right before the [endIndex].
*