Skip to content

Commit bca6844

Browse files
committed
Add more documentation for string functions (see JuliaLang#2147 & JuliaLang#2242)
1 parent 8f33736 commit bca6844

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

doc/stdlib/base.rst

+31-1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ General Collections
227227

228228
For ordered, indexable collections, the maximum index ``i`` for which ``ref(collection, i)`` is valid. For unordered collections, the number of elements.
229229

230+
.. function:: endof(collection) -> Integer
231+
232+
Returns the last index of the collection.
233+
234+
**Example**: ``endof([1,2,4]) = 3``
235+
230236
Fully implemented by: ``Range``, ``Range1``, ``Tuple``, ``Number``, ``AbstractArray``, ``IntSet``, ``Dict``, ``WeakKeyDict``, ``String``, ``Set``.
231237

232238
Partially implemented by: ``FDSet``.
@@ -314,6 +320,10 @@ Iterable Collections
314320

315321
**Example**: ``map((x) -> x * 2, [1, 2, 3]) = [2, 4, 6]``
316322

323+
.. function:: map!(function, collection)
324+
325+
In-place version of :func:`map`.
326+
317327
.. function:: mapreduce(f, op, itr)
318328

319329
Applies function ``f`` to each element in ``itr`` and then reduces the result using the binary function ``op``.
@@ -517,7 +527,7 @@ Dequeues
517527

518528
Remove items at specified range.
519529

520-
.. function:: grow!(collection, n) -> collectionf
530+
.. function:: resize!(collection, n) -> collection
521531

522532
Resize collection to contain ``n`` elements.
523533

@@ -582,6 +592,26 @@ Strings
582592

583593
Convert a string to a contiguous UTF-8 string (all characters must be valid UTF-8 characters).
584594

595+
.. function:: is_valid_ascii(s) -> Bool
596+
597+
Returns true if the string is valid ASCII, false otherwise.
598+
599+
.. function:: is_valid_utf8(s) -> Bool
600+
601+
Returns true if the string is valid UTF-8, false otherwise.
602+
603+
.. function:: check_ascii(s)
604+
605+
Calls :func:`is_valid_ascii` on string. Throws error if it is not valid.
606+
607+
.. function:: check_utf8(s)
608+
609+
Calls :func:`is_valid_utf8` on string. Throws error if it is not valid.
610+
611+
.. function:: byte_string_classify(s)
612+
613+
Returns 0 if the string is neither valid ASCII nor UTF-8, 1 if it is valid ASCII, and 2 if it is valid UTF-8.
614+
585615
.. function:: search(string, char, [i])
586616

587617
Return the index of ``char`` in ``string``, giving 0 if not found. The second argument may also be a vector or a set of characters. The third argument optionally specifies a starting index.

0 commit comments

Comments
 (0)