Commit Graph

103 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 4ae19b2b44 [K/N] Deprecate SharedImmutable annotation #KT-57837
As a part of efforts to stabilize Native stdlib.
2023-06-19 11:35:32 +00:00
Abduqodiri Qurbonzoda 7acaf6e473 [K/N] String.indexOf matches byte sequences not on the char boundary #KT-56637
If the found index is odd, retry search from index + 1.

Merge-request: KT-MR-10364
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-06-01 12:56:32 +00:00
Pavel Kunyavskiy 9b366af38b [K/N] Fix String.compareTo on unicode strings
^KT-49873
2021-12-01 07:51:27 +00:00
Svyatoslav Kuzmich 5b10396f48 [stdlib] Test that modification of the array returned by toCharArray() doesn't affect the original string 2021-10-28 15:49:00 +00:00
Abduqodiri Qurbonzoda f8bcba0b76 Align JS String.equals/compareTo(ignoreCase) behavior with JVM #KT-48999 2021-09-30 15:35:50 +00:00
Abduqodiri Qurbonzoda aa543c6631 Migrate stdlib, tests and samples to new case conversion api 2021-04-08 03:22:01 +03:00
Ilya Gorbunov 22ca412dd2 Fix case-insensitive character-wise comparison KT-45496
- Step 1: add failing tests
- Step 2: fix common case insensitive Char.equals
- Step 3: fix case insensitive String.equals in K/JS
- Step 4: enable unicode case folding in K/JS Regexes and
  string replacement (KT-45928)
- Step 5: fix case insensitive char comparison in K/N in String functions
  String.replace, equals, compareTo with ignoreCase
2021-04-07 14:43:41 +03:00
Abduqodiri Qurbonzoda d28d0a6321 Advance String(CharArray) deprecation level to ERROR in Common and JS 2021-04-07 00:23:29 +03:00
Abduqodiri Qurbonzoda ed57bcb3b1 Commonize and generalize JVM-only String.contentEquals #KT-42840 2021-03-06 11:14:30 +03:00
Abduqodiri Qurbonzoda 0c9205423f Add String case conversion tests 2021-03-02 01:11:42 +03:00
Abduqodiri Qurbonzoda 662787b12b Straighten Char-to-code and Char-to-digit conversions out #KT-23451 2020-12-31 12:07:41 +03:00
Abduqodiri Qurbonzoda 1314adb6f7 Locale-agnostic case conversions by default #KT-43023 2020-12-30 10:08:25 +03:00
Svyatoslav Scherbina 0f4173cdfa Fix running stdlib tests in worker on Native
Add `@SharedImmutable` or `@ThreadLocal` where required.
2020-12-14 19:03:06 +03:00
Ilya Gorbunov 149bcc2d22 Revert using regex Pattern in String.replace
Use String.indexOf(..., ignoreCase) instead in all branches to preserve
compatibility with behavior before 1.4.20 that used String.split which
essentially relied on that String.indexOf

#KT-43745 Fixed
2020-12-04 17:43:54 +03:00
Ilya Gorbunov fafb4a7914 Use regex for case-insensitive String.replace
KT-41799
2020-10-02 00:29:26 +03:00
Ilya Gorbunov 349cad7b9a Minor: migrate remaining scanReduceIndexed usages 2020-09-11 19:08:04 +03:00
Ilya Gorbunov 130987fa1e Provide flatMapIndexed operation
- similar to flatMap, but transform function takes index and element

#KT-36894
2020-06-19 17:55:15 +03:00
Abduqodiri Qurbonzoda 846a7823ad Introduce minOrNull and maxOrNull extension functions #KT-39064 2020-06-19 04:53:49 +03:00
Abduqodiri Qurbonzoda 6a2fed33d3 Deprecate old CharArray to String conversion api #KT-31343 2020-06-08 04:12:28 +03:00
Abduqodiri Qurbonzoda 57597f5900 Fix String.toHashSet tests 2020-04-20 04:08:29 +03:00
Abduqodiri Qurbonzoda 0d5ec27ac4 toHashSet is suboptimal for inputs with a lot of duplicates #KT-23142 2020-04-19 07:58:49 +03:00
Ilya Gorbunov 893021f22b Introduce runningFold and runningReduce operations
runningFold is a synonym for scan,
runningReduce replaces scanReduce.

#KT-38060
2020-04-15 23:28:07 +03:00
Abduqodiri Qurbonzoda 4a7b1b210a Add onEachIndexed similar to forEachIndexed #KT-37161 2020-04-11 03:47:47 +03:00
Abduqodiri Qurbonzoda b1fac4e721 Implement reduceIndexedOrNull and reduceRightIndexedOrNull #KT-36866 2020-03-12 18:08:55 +03:00
Abduqodiri Qurbonzoda ed7b8e9b85 Scan functions for Sequences and Iterable #KT-7657 2020-02-13 04:01:47 +03:00
Abduqodiri Qurbonzoda 3cad1bbb51 Create method Collection.randomOrNull() #KT-35347 2020-01-16 22:25:53 +03:00
Alfredo Delli Bovi f5d696d3c4 KT-33761 Add reduceOrNull 2019-12-26 19:27:46 +03:00
Abduqodiri Qurbonzoda e54b405fe4 Fix Iterable, Sequence and String index overflow in windowed 2019-10-09 19:48:39 +03:00
Abduqodiri Qurbonzoda d66f07a84e CollectionsKt.windowed throws IllegalArgumentException 2019-09-20 00:50:54 +03:00
Abduqodiri Qurbonzoda 81d2d3cb6a Implement String to/from CharArray conversion (KT-29265) 2019-05-06 15:54:28 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Abduqodiri Qurbonzoda ba61695a45 Check for index-out-of-bound in elementAt function (KT-30051) 2019-03-12 21:39:09 +03:00
Ilya Gorbunov 30c769c19a Avoid hitting max argument limit in String(chars)
Rewrite CharArray to String conversions to appending chars one by one.

Refine parameter checking in String(chars, offset, length) to adhere to
the common exception contract and document it.

#KT-29003
2019-01-10 23:35:52 +03:00
Ilya Gorbunov 2b699f8f07 Add a test for CharSequence/String.regionMatches 2018-11-01 17:51:24 +03:00
Ilya Gorbunov ea2c33a532 Extension random() to select random element from a collection
Fixes #KT-15539
2018-08-30 16:21:27 +03:00
Ilya Gorbunov f367322084 Introduce associateWith and associateWithTo functions
#KT-13814
2018-08-30 14:58:14 +03:00
Ilya Gorbunov ed53983e1e Add support for CASE_INSENSITIVE_ORDER in JS and common
#KT-18067
2018-08-15 21:28:54 +03:00
Ilya Gorbunov 6866f5d19a Move test and cover more cases of string comparison
#KT-18067
2018-08-15 21:28:50 +03:00
Toshiaki Kameyama f05a19aafb JS stdlib: implement String.compareTo with ignoreCase
#KT-18067 Fixed
2018-08-15 21:28:44 +03:00
Neonailol ede2e227c2 KT-23356 Cross-platform function to convert CharArray slice to String
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
2018-05-26 06:06:53 +03:00
Ilya Gorbunov ecf0d7ec0d Reformat stdlib tests and samples
#KT-5558
2018-04-27 05:28:57 +03:00
Ilya Gorbunov e21c235bbb Add or update copyrights in the standard library sources 2018-04-26 21:57:50 +03:00
Vsevolod 510e17246f KT-16661 Simplify Strings#split
Do not search for next occurrence if limit is reached.
2018-01-23 13:29:29 +03:00
Vsevolod 2805371bdc KT-16661 Provide fast-path for Strings#split with single delimiter
Optimize single delimiter split when no matches is found:
Return listOf() of single element instead of adding 'this' to result
because underlying array in ArrayList is created lazily and
by default its size is 16.

Pre-size resulting list in split when limit is known.
2018-01-23 13:29:05 +03:00
Ilya Gorbunov 20b122c1dd Use kotlin.test.Test instead of org.junit.Test in common stdlib tests
(and in jvm-only and js-only tests also)
2017-10-15 17:40:53 +03:00
Ilya Gorbunov 559255f38e windowed function: add default parameters, drop or keep partial windows, KEEP-11
Make step default to 1.
Add partialWindows boolean parameter defaulting to false to control
whether to keep partial windows in the end.
2017-10-11 19:20:24 +03:00
Ilya Gorbunov c04b0072af Rename pairwise to zipWithNext, KEEP-11 2017-10-11 19:20:24 +03:00
Ilya Gorbunov 18c7a01ab5 Add tests for windowed and chunked, fix precondition checks 2017-10-11 19:20:24 +03:00
Ilya Gorbunov c815ccfd6a Introduce 'pairwise' function, KEEP-11 2017-10-11 19:20:24 +03:00
Ilya Gorbunov 6ae19e03d5 Clean warnings and refactor stdlib tests.
Merge RangeJVMTest into RangeTest.
2017-04-18 18:51:20 +03:00