1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use stdin;
/// Gets the first char of a string, and returns it as string.
///
/// ```
/// let hello = String::from("Hello");
/// let first = yarns::head(&hello);
/// //first = (String)"H"
/// ```
/// Returns a new string starting at the index provided in the second argument, going the length provided as the third argument.
///
/// ```
/// let hello = String::from("Hello");
/// let sub= yarns::substr(&hello, 1, 3);
/// //sub = (String) "ell"
/// ```
/// Concatenates two strings.
///
/// ```
/// let hello = String::from("Hello");
/// let world = String::from("World");
/// let hw = yarns::concat(&hello, &world);
/// //hw = (String)"HelloWorld"
/// ```
/// Returns wether a given String contains the given Substring.
///
/// ```
/// let hello = String::from("Hello");
/// let ell = String::from("ell");
/// let has_it = yarns::contains(&hello, &ell);
/// //has_it = (bool) true
/// ```
/// Shortcut for simple binding of user input to an immutable String.
/// Returns the length of the utf-8 representation of a string.
///
/// ```
/// let hello = String::from("Hello");
/// let length = yarns::len(&hello);
/// //length = 5
/// ```