Suggest to replace 'substring' calls by take/drop/dropLast calls when possible

#KT-10196 Fixed
This commit is contained in:
Anton Sukhonosenko
2016-01-02 16:52:05 +03:00
parent 0a3631db6a
commit ba0efda2f0
59 changed files with 672 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ReplaceSubstringWithTakeIntention
@@ -0,0 +1,8 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
const val x = 0
fun foo(s: String) {
s.substring<caret>(x, 10)
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(1 - 1, 10)
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(1, 10)
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(0, 10)
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.take(10)
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(0, 10);
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String) {
s.take(10);
}