Module String
module String: sig .. end
String operations.
A string is an immutable data structure that contains a fixed-length sequence of (single-byte) characters. Each character can be accessed in constant time through its index.
Given a string s of length l, we can access each of the l characters of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two characters or at the beginning or end of the string. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the character at index n is between positions n and n+1.
Two parameters start and len are said to designate a valid substring of s if len >= 0 and start and start+len are valid positions in s.
Note: OCaml strings used to be modifiable in place, for instance via the String.set and String.blit functions described below. This usage is only possible when the compiler is put in "unsafe-string" mode by giving the -unsafe-string command-line option. This compatibility mode makes the types string and bytes (see module Bytes) interchangeable so that functions expecting byte sequences can also accept strings as arguments and modify them.
The distinction between bytes and string was introduced in OCaml 4.02, and the "unsafe-string" compatibility mode was the default until OCaml 4.05. Starting with 4.06, the compatibility mode is opt-in; we intend to remove the option in the future.
Loading, please wait
|
| Tags | Name | Argument 1 | Argument 2 | Argument 3 | Argument 4 | Argument 5 | Return Type | Usage Count |
|
| Core | set | bytes | int | char | | | unit | 19,965 |
|
| Core | fill | bytes | int | int | char | | unit | 1,009 |
|
| Core | split_on_char | char | string | | | | string list | 3,720 |
|
| Functional Iterators | of_seq | char Seq.t | | | | | t | 85 |
|
| Core | create | int | | | | | bytes | 15,854 |
|
| Core | make | int | char | | | | string | 46,643 |
|
| Core | init | int | (int -> char) | | | | string | 2,685 |
|
| Core | length | string | | | | | int | 109,761 |
|
| Core | copy | string | | | | | string | 2,239 |
|
| Core | trim | string | | | | | string | 4,253 |
|
| Core | escaped | string | | | | | string | 6,775 |
|
| Core | uppercase | string | | | | | string | 3,945 |
|
| Core | lowercase | string | | | | | string | 10,740 |
|
| Core | capitalize | string | | | | | string | 7,952 |
|
| Core | uncapitalize | string | | | | | string | 2,938 |
|
| Core | uppercase_ascii | string | | | | | string | 1,082 |
|
| Core | lowercase_ascii | string | | | | | string | 2,953 |
|
| Core | capitalize_ascii | string | | | | | string | 2,809 |
|
| Core | uncapitalize_ascii | string | | | | | string | 883 |
|
| Core | index | string | char | | | | int | 15,812 |
|
| Core | index_opt | string | char | | | | int option | 483 |
|
| Core | rindex | string | char | | | | int | 5,345 |
|
| Core | rindex_opt | string | char | | | | int option | 315 |
|
| Core | contains | string | char | | | | bool | 9,168 |
|
| Core | get | string | int | | | | char | 19,933 |
|
| Core | blit | string | int | bytes | int | int | unit | 6,302 |
|
| Core | index_from | string | int | char | | | int | 4,204 |
|
| Core | index_from_opt | string | int | char | | | int option | 283 |
|
| Core | rindex_from | string | int | char | | | int | 1,330 |
|
| Core | rindex_from_opt | string | int | char | | | int option | 239 |
|
| Core | contains_from | string | int | char | | | bool | 811 |
|
| Core | rcontains_from | string | int | char | | | bool | 728 |
|
| Core | sub | string | int | int | | | string | 50,519 |
|
| Core | concat | string | string list | | | | string | 63,302 |
|
| Functional Iterators | to_seq | t | | | | | char Seq.t | 218 |
|
| Functional Iterators | to_seqi | t | | | | | (int * char) Seq.t | 10 |
|
| Core | compare | t | t | | | | int | 11,381 |
|
| Core | equal | t | t | | | | bool | 9,270 |
|
| Core | map | (char -> char) | string | | | | string | 14,487 |
|
| Core | iter | (char -> unit) | string | | | | unit | 4,935 |
|
| Core | mapi | (int -> char -> char) | string | | | | string | 467 |
|
| Core | iteri | (int -> char -> unit) | string | | | | unit | 382 |