aboutsummaryrefslogtreecommitdiff
path: root/src/string_immutable.zig
blob: 7613509c01a12f1989efa1c3dd1facedb09d4c52 (plain) (blame)
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
const std = @import("std");
const expect = std.testing.expect;

usingnamespace @import("string_types.zig");

pub fn containsChar(self: string, char: u8) bool {
    return std.mem(char) != null;
}

pub fn indexOfChar(self: string, char: u8) ?usize {
    return std.mem.indexOfScalar(@TypeOf(char), self, char);
}

pub fn lastIndexOfChar(self: string, char: u8) ?usize {
    return std.mem.lastIndexOfScalar(u8, self, char);
}

pub fn lastIndexOf(self: string, str: u8) ?usize {
    return std.mem.lastIndexOf(u8, self, str);
}

pub fn indexOf(self: string, str: u8) ?usize {
    return std.mem.indexOf(u8, self, str);
}

pub fn eql(self: string, other: anytype) bool {
    return std.mem.eql(u8, self, other);
}