@@ -833,7 +833,7 @@ defmodule String do
833
833
defdelegate next_codepoint ( string ) , to: String.Unicode
834
834
835
835
@ doc ~S"""
836
- Checks whether `str ` contains only valid characters.
836
+ Checks whether `string ` contains only valid characters.
837
837
838
838
## Examples
839
839
@@ -927,20 +927,20 @@ defmodule String do
927
927
928
928
def chunk ( "" , _ ) , do: [ ]
929
929
930
- def chunk ( str , trait ) when trait in [ :valid , :printable ] do
931
- { cp , _ } = next_codepoint ( str )
930
+ def chunk ( string , trait ) when trait in [ :valid , :printable ] do
931
+ { cp , _ } = next_codepoint ( string )
932
932
pred_fn = make_chunk_pred ( trait )
933
- do_chunk ( str , pred_fn . ( cp ) , pred_fn )
933
+ do_chunk ( string , pred_fn . ( cp ) , pred_fn )
934
934
end
935
935
936
- defp do_chunk ( str , flag , pred_fn ) , do: do_chunk ( str , [ ] , << >> , flag , pred_fn )
936
+ defp do_chunk ( string , flag , pred_fn ) , do: do_chunk ( string , [ ] , << >> , flag , pred_fn )
937
937
938
938
defp do_chunk ( << >> , acc , << >> , _ , _ ) , do: Enum . reverse ( acc )
939
939
940
940
defp do_chunk ( << >> , acc , chunk , _ , _ ) , do: Enum . reverse ( acc , [ chunk ] )
941
941
942
- defp do_chunk ( str , acc , chunk , flag , pred_fn ) do
943
- { cp , rest } = next_codepoint ( str )
942
+ defp do_chunk ( string , acc , chunk , flag , pred_fn ) do
943
+ { cp , rest } = next_codepoint ( string )
944
944
if pred_fn . ( cp ) != flag do
945
945
do_chunk ( rest , [ chunk | acc ] , cp , not flag , pred_fn )
946
946
else
@@ -1523,7 +1523,7 @@ defmodule String do
1523
1523
@ doc """
1524
1524
Returns a float value between 0 (equates to no similarity) and 1 (is an exact match)
1525
1525
representing [Jaro](https://en.wikipedia.org/wiki/Jaro–Winkler_distance)
1526
- distance between `str1 ` and `str2 `.
1526
+ distance between `string1 ` and `string2 `.
1527
1527
1528
1528
The Jaro distance metric is designed and best suited for short strings such as person names.
1529
1529
@@ -1537,15 +1537,15 @@ defmodule String do
1537
1537
"""
1538
1538
1539
1539
@ spec jaro_distance ( t , t ) :: 0 .. 1
1540
- def jaro_distance ( str1 , str2 )
1540
+ def jaro_distance ( string1 , string2 )
1541
1541
1542
- def jaro_distance ( str , str ) , do: 1.0
1543
- def jaro_distance ( _str , "" ) , do: 0.0
1544
- def jaro_distance ( "" , _str ) , do: 0.0
1542
+ def jaro_distance ( string , string ) , do: 1.0
1543
+ def jaro_distance ( _string , "" ) , do: 0.0
1544
+ def jaro_distance ( "" , _string ) , do: 0.0
1545
1545
1546
- def jaro_distance ( str1 , str2 ) do
1547
- { chars1 , len1 } = decompose ( str1 )
1548
- { chars2 , len2 } = decompose ( str2 )
1546
+ def jaro_distance ( string1 , string2 ) do
1547
+ { chars1 , len1 } = decompose ( string1 )
1548
+ { chars2 , len2 } = decompose ( string2 )
1549
1549
1550
1550
case match ( chars1 , len1 , chars2 , len2 ) do
1551
1551
{ 0 , _trans } -> 0.0
@@ -1557,8 +1557,8 @@ defmodule String do
1557
1557
end
1558
1558
1559
1559
@ compile { :inline , decompose: 1 }
1560
- defp decompose ( str ) do
1561
- chars = graphemes ( str )
1560
+ defp decompose ( string ) do
1561
+ chars = graphemes ( string )
1562
1562
{ chars , Kernel . length ( chars ) }
1563
1563
end
1564
1564
0 commit comments