Add String.count/2 to count occurrences of a pattern
Update to Unicode 17.0.0
Module
91 changes across 44 versions
Changes by version
Add String.count/2 to count occurrences of a pattern
Update to Unicode 17.0.0
Inspect special whitespace and zero-width characters using their Unicode representation
Update Unicode to 16.0
Add String.byte_slice/3 to slice a string to a maximum number of bytes while keeping it UTF-8 encoded
Fix String.capitalize/1 with a single codepoint
Update to Unicode 15.1.0
Add String.replace_invalid/2
Deprecate passing a range with negative step on String.slice/2, give first..last//1 instead
Update Unicode to version 15.0.0
Add :fast_ascii mode to String.valid?/2
Fix String.split/3 and String.next_grapheme/1 returning invalid results on invalid UTF-8 encoding
Support empty lookup lists in String.replace/3, String.split/3, and String.splitter/3
Allow slicing with steps in String.slice/2
Allow slices to overflow on both starting and ending positions
Deprecate passing a binary compiled pattern to String.starts_with?/2
Fix error for certain codepoint combinations in String.split_at/2
Fix incorrect codepoint byte counting in slice with negative positions in ranges
Update Unicode database to version 14.0
Add :turkic mode option to String case functions
Update to Unicode 13.0
Undeprecate String.normalize/2 normalize and fix infinite loop caused by certain invalid strings
Update to Unicode 12.1
String.normalize/2 has been deprecated in favor of :unicode.characters_to_nfc_binary/1 or :unicode.characters_to_nfd_binary/1 which ship as part of Erlang/OTP 20+
The :insert_replaced option in String.replace/4 has been deprecated. Instead you may pass a function as a replacement or use :binary.replace/4 if you need to support earlier Elixir versions
Add String.bag_distance/2
Fix ZWJ handling in Unicode grapheme clusters
Update to Unicode 11
Add performant impl for string upcase/downcase :ascii mode
Update to Unicode 10
Allow passing empty string match to String.replace/4
Support context and language sensitive operations in String.upcase/2 and String.downcase/2. Currently only the :greek context is supported
Support :ascii conversion in String.upcase/2 and String.downcase/2
Return a leading empty space when splitting on empty string. This makes the split operation consistent with the other operations in the String module
Optimise binary pattern matching in String.split/1 and String.trim_*/1
Consider Unicode non-characters valid according to the specification in String.valid?/1
String.ljust/3 and String.rjust/3 are deprecated in favor of String.pad_leading/3 and String.pad_trailing/3 with a binary padding
String.strip/1 and String.strip/2 are deprecated in favor of String.trim/1 and String.trim/2
String.lstrip/1 and String.rstrip/1 are deprecated in favor of String.trim_leading/1 and String.trim_trailing/1
String.lstrip/2 and String.rstrip/2 are deprecated in favor of String.trim_leading/2 and String.trim_trailing/2 with a binary as second argument
Incorporate new grapheme rules in Unicode 9
Update to Unicode 9.0.0
Fix infinite recursion in String.replace_leading/3 and String.replace_trailing/3 when given an empty string
Add String.myers_difference/2 for calculating the difference between two strings
Ensure strip also removes non-breaking whitespaces (and ensure split still does not split on them)
The confusing String.strip/2, String.lstrip/2 and String.rstrip/2 API has been soft deprecated in favor of String.trim/2, String.trim_leading/2 and String.trim_trailing/2
The confusing String.ljust/3 and String.rjust/3 API has been soft deprecated in favor of String.pad_leading/3 and String.pad_trailing/3
String.valid_character?/1 is deprecated in favor of String.valid?/1 with pattern matching
Fix a bug in NFD normalization when followed by one-byte sized graphemes
Fix bugs in String.replace_* functions where it would not include the accumulated value for certain replacements
Update version of the Unicode database to 8.0.0
Ensure split/1 does not break on non-breakable whitespace
Ensure NFC and NFD normalization pass all of Unicode 8.0.0 tests
Fix incomplete data trimming on both String.replace_trailing and String.rstrip
Attach debug_info back into Unicode modules for Dialyzer support
Introduce String.replace_{prefix,suffix,leading,trailing}/2. The first two will replace only the first occurrence of the given match in string. The last two will replace all occurrences of the given match
Support String.normalize/2 and String.equivalent?/2 that perform NFD and NFC normalization
Ensure UnicodeConversionError does not contain invalid string in its error message
Support calculation of the jaro distance between strings (usually names) via String.jaro_distance/2. This is used by Mix to support "Did you mean?" feature when a task does not exist
Add String.splitter/3 that splits strings as a stream
Passing an empty string to starts_with?, contains? and ends_with? had dubious behaviour and have been deprecated to help developers identify possible bugs in their source code
Optimize String.rstrip/1
Optimize String.downcase/1
Optimize String.upcase/1
Fix LFCR being treated as a grapheme instead of CRLF
Fix String.replace/4 typespec
String.slice/2 and String.slice/3 have been optimized
\NNN, \NN and \N for octals are deprecated inside string, sigils and chars in favor of hexadecimal entries with \x
Improve performance of String.split/1
Updated Unicode database to 7.0
String.slice/2 and String.slice/3 always returns a list (and never nil)
Add String.chunk/2
String.from_char_data/1 and String.from_char_data!/1 deprecated in favor of List.to_string/1
String.to_char_list/1 (previously deprecated) no longer returns a tuple but the char list only and raises in case of failure
Support :parts in String.split/3
Deprecate :global option in String.split/3 in favor of parts: :infinity
String.to_char_list/1 is deprecated in favor of List.from_char_data/1 (this is a soft deprecation, no warnings will be emitted)
String.from_char_list/1 is deprecated in favor of String.from_char_data/1 (this is a soft deprecation, no warnings will be emitted)
Change String.next_grapheme/1 and String.next_codepoint/1 to return nil on string end
Update to Unicode 6.3.0
Add String.slice/2 with a range
Implement the extended grapheme cluster algorithm for String operations
String.to_integer/1 and String.to_float/1 are deprecated in favor of Integer.parse/1 and Float.parse/1
Fix a bug with String.split/2 when given an empty pattern
String.valid_codepoint?/1 is deprecated in favor of pattern matching with <<_ :: utf8 >>
Add regex pattern support to String.replace/3
Add String.ljust/2, String.rjust/2, String.ljust/3 and String.rjust/3
String.strip/2 now supports removing unicode characters
String.slice/3 still returns the proper result when there is no length to be extracted
Add Regex.scan/3 now supports capturing groups
Add String.reverse/1