Commit Graph

94 Commits

Author SHA1 Message Date
Laszlo Hornyak 6fda0816f3 buildString with initial capacity for the StringBuilder instance
this method helps save computation time when the developer knows or have a good
educated guess about the size of the generated string and have to use control
structures while filling the string builder

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2016-08-10 18:23:32 +03:00
Ilya Gorbunov 4b533b297e reified assertFailsWith available in kotlin-test for JS
#KT-11346
2016-04-27 18:22:20 +03:00
Ilya Gorbunov f564adfdd4 Optimize trivial cases of CharSequence.repeat. Provide CharSequence.repeat for JS.
#KT-3064 Fixed
2016-02-26 01:23:30 +03:00
Ilya Gorbunov 3c35395cf7 Minor: refactor some tests to use nested classes. 2016-02-21 04:18:11 +03:00
Ilya Gorbunov c243a2bdd5 In addition to extension String.format introduce String.Companion.format(format, args) to be used like in java. 2016-02-03 17:14:01 +03:00
Ilya Gorbunov 148b53fc62 Add UTF_32 charsets to Charsets object as lazy initialized properties.
#KT-10379 Fixed
2016-02-02 15:23:22 +03:00
Ilya Gorbunov 4f1418bb72 Verify index expectations for reduceIndexed/reduceRightIndexed 2016-01-31 02:45:05 +03:00
Gabriel Borges d58efff974 Add foldIndexed and reduceIndexed groups of functions
- foldIndexed, foldRightIndexed, reduceIndexed and reduceRightIndexed have been added, in line with filterIndexed etc.;
- Test cases added appropriately for the new functions.
2016-01-31 02:45:02 +03:00
Ilya Gorbunov c1ad82ff8c Harden charset-as-string taking function deprecations.
Fix usages in compiler.
2016-01-22 05:54:38 +03:00
Ilya Gorbunov dbcad08a35 Regex: MatchResult.groupValues do not exclude zeroth group, use the same indices as in groups collection.
Provide destructured property for destructured assignment.
2016-01-22 00:59:13 +03:00
Ilya Gorbunov 3459a24b0a Regex: Introduce MatchResult.groupValues to get list of numbered group values exlcuding zeroth group with the entire match. 2016-01-22 00:56:08 +03:00
Ilya Gorbunov b61bef324d Make Char.category and directionality properties instead of functions.
Provide contains(Char) operator for CharCategory.
2015-11-21 00:54:30 +03:00
Ilya Gorbunov 775755dfac Introduce String.toCharArray() instead of String.getChars()
Make special method conversion for java.lang.String.getChars() in J2K
2015-11-21 00:54:29 +03:00
Ilya Gorbunov 07654eb82b StdLib cleanup, deprecated symbol usage: size() and length() 2015-11-21 00:54:05 +03:00
Ilya Gorbunov 008a8059cf Introduce filterIndexed
#KT-9502 Fixed
2015-11-11 02:42:52 +03:00
Ilya Gorbunov 1400bdc09a Do not allow removeSurrounding remove overlapping prefix and suffix. 2015-11-04 22:19:59 +03:00
Ilya Gorbunov 05fd2b012a Provide overloads both for Strings and CharSequences of filter, filterNot, reversed and partition 2015-11-04 22:19:57 +03:00
Ilya Gorbunov 62d6bcaa6d Provide overloads both for Strings and CharSequences of removePrefix, removeSuffix, removeSurronding, trim* and pad*, replaceRange & removeRange 2015-11-04 22:19:55 +03:00
Ilya Gorbunov 8c16fad8b1 Make more string tests cross-platform. 2015-11-04 22:19:48 +03:00
Ilya Gorbunov d021a324aa Test CharSequence extension methods both for String and StringBuilder 2015-11-04 22:19:43 +03:00
Daniel Rothmaler 67229401c6 Add set operator to make the work with StringBuilder more list-like.
Make StringBuilder.set jvm-only.
Move jvm-specific test.
2015-11-04 22:19:33 +03:00
Ilya Gorbunov 05615dd48b Introduce String.toByte()
#KT-8833 Fixed
2015-11-04 22:19:22 +03:00
Ilya Gorbunov 9bbe0d67ff Do not treat directory with copied test sources for js library as source root, as it confuses debugger under certain circumstances.
Remove duplicated test.
2015-11-04 22:19:20 +03:00
Ilya Gorbunov 43bb9347c6 Rename Regex.hasMatch to containsMatchIn, and add corresponding contains function to CharSequence. 2015-10-14 22:49:50 +03:00
Ilya Gorbunov d1d865aa0f Rename methods in Regex. Add matchEntire method to match entire string against regex. 2015-10-14 22:49:48 +03:00
Ilya Gorbunov d860f335a3 JS: Make StringBuilder implement CharSequence and introduce secondary constructors. 2015-10-14 22:49:47 +03:00
Denis Zharkov f0e3fd617d Adjust testData to CharSequence.length transformation 2015-10-14 20:39:35 +03:00
Denis Zharkov cb562e7ea5 Adjust JS backend to CharSequence.length transformation 2015-10-14 20:39:32 +03:00
Ilya Gorbunov cac7bfc80b Clarify some type in tests. 2015-10-14 18:26:46 +03:00
Ilya Gorbunov af0a59dd02 Deprecate StringBuilder { } function, and introduce buildString { } instead.
#KT-7295 Fixed
2015-10-14 18:19:57 +03:00
Ilya Gorbunov 6d7cc0671e Allow equals with ignoreCase parameter to take nullable Strings both as a receiver and a parameter.
#KT-9188
2015-10-14 18:19:56 +03:00
Ilya Gorbunov 12d9beb3a4 Deprecate join (use joinToString instead)
#KT-6909
2015-10-08 17:48:33 +03:00
Ilya Gorbunov c54ffe39b1 Drop deprecated API: String operations. 2015-10-07 22:36:41 +03:00
Ilya Gorbunov 73e41fb216 StdLib cleanup: remove unused imports 2015-10-07 22:36:13 +03:00
Ilya Gorbunov ff69b97030 StdLib cleanup: deprecated usages 2015-10-07 22:36:09 +03:00
Ilya Gorbunov 404b228954 StdLib cleanup: replace fails with assertFails 2015-10-07 22:36:06 +03:00
Denis Zharkov 5cecaa6f87 Get rid of deprecated annotations and modifiers in stdlib (besides JS) 2015-09-18 10:14:28 +03:00
Ilya Gorbunov f7c2f034b3 Remove usages of deprecated failsWith 2015-09-08 10:28:03 +03:00
Ilya Gorbunov ca798d8d71 Rename reverse to reversed.
#KT-8171
2015-08-27 11:45:30 +03:00
Sergey Mashkov 84ef068f5d #KT-8708 refactor trimIndent, trimMargin, replaceIndent, replaceIndentByMargin, prependIndent 2015-08-12 18:45:10 +03:00
Sergey Mashkov 7afa40590d KT-8708 Function to strip leading whitespace (stripMargin, trimMargin, stripIndent?) 2015-08-12 18:45:10 +03:00
Ilya Gorbunov 15d69499d0 Stop matching after the end of the input sequence was reached.
#KT-8763 Fixed
2015-08-11 05:11:32 +03:00
Ilya Gorbunov f3a19ebe11 StdLib deprecations cleanup: length, size, indices and other collection operations. 2015-06-29 17:06:20 +03:00
Ilya Gorbunov 00a44f6d4f StdLib deprecations cleanup: *array -> *arrayOf, copyToArray -> toTypedArray. 2015-06-29 17:05:57 +03:00
Ilya Gorbunov d20d8e2106 2nd stage of replaceFirst semantics change: remove deprecated String.replaceFirst(String), rename replaceFirstLiteral to replaceFirst. 2015-06-24 21:48:09 +03:00
Ilya Gorbunov 249106647c 2nd stage of split semantics change: remove deprecated String.split(String), rename splitBy back to split. Provide replacement for splitBy and splitWithRegex (JS). 2015-06-24 21:48:07 +03:00
Ilya Gorbunov 9f85fa9720 Make proposed split replacement equivalent in behavior with additional dropLastWhile call.
#KT-7887
2015-06-04 16:32:23 +03:00
Ilya Gorbunov 33f5158170 Fix deprecated replaceAll and replaceFirst usages in stdlib tests and tools. 2015-05-22 16:13:55 +03:00
Ilya Gorbunov 6516c74a1a Revert back 2nd stage of split semantics change and restore deprecated String.split(String). 2015-05-21 23:13:16 +03:00
Ilya Gorbunov d531d7130f Add an optional parameter to joinToString() and joinTo() functions: lambda function which maps the element to string.
#KT-5468 Fixed
2015-05-09 01:11:47 +03:00