2
2
3
3
# Zig String (A UTF-8 String Library)
4
4
5
- This library is a UTF-8 compatible ** string** library for the ** Zig** programming language.
5
+ This library is a UTF-8 compatible ** string** library for the ** Zig** programming language.
6
6
I made this for the sole purpose to further my experience and understanding of zig.
7
7
Also it may be useful for some people who need it (including myself), with future projects. Project is also open for people to add to and improve. Please check the ** issues** to view requested features.
8
8
9
9
# Basic Usage
10
+
10
11
``` zig
11
12
const String = @import("./zig-string.zig").String;
12
13
// ...
@@ -30,6 +31,7 @@ assert(myString.cmp("🔥 Hello, World 🔥"));
30
31
```
31
32
32
33
# Installation
34
+
33
35
Add this to your build.zig.zon
34
36
35
37
``` zig
@@ -59,14 +61,15 @@ You can then import the library into your code like this
59
61
const String = @import("string").String;
60
62
```
61
63
62
-
63
64
# Things needed
65
+
64
66
- Optimizations
65
67
- Multi-Language toUppercase & toLowercase
66
68
- Better documentation
67
69
- More Testing
68
70
69
71
# How to Contribute
72
+
70
73
1 . Fork
71
74
2 . Clone
72
75
3 . Add Features (Use Zig FMT)
@@ -75,45 +78,46 @@ const String = @import("string").String;
75
78
6 . Success!
76
79
77
80
# Working Features
81
+
78
82
If there are any issues with <b >complexity</b > please <b >open an issue</b >
79
83
(I'm no expert when it comes to complexity)
80
84
81
- Function | Description
82
- --------------| ------------------------------------------
83
- allocate | Sets the internal buffer size
84
- capacity | Returns the capacity of the String
85
- charAt | Returns character at index
86
- clear | Clears the contents of the String
87
- clone | Copies this string to a new one
88
- cmp | Compares to string literal
89
- concat | Appends a string literal to the end
90
- deinit | De-allocates the String
91
- find | Finds first string literal appearance
92
- rfind | Finds last string literal appearance
93
- init | Creates a String with an Allocator
94
- init_with_contents| Creates a String with specified contents
95
- insert | Inserts a character at an index
96
- isEmpty | Checks if length is zero
97
- iterator | Returns a StringIterator over the String
98
- len | Returns count of characters stored
99
- pop | Removes the last character
100
- remove | Removes a character at an index
101
- removeRange | Removes a range of characters
102
- repeat | Repeats string n times
103
- reverse | Reverses all the characters
104
- split | Returns a slice based on delimiters
105
- splitToString | Returns a String based on delimiters
106
- str | Returns the String as a slice
107
- substr | Creates a string from a range
108
- toLowercase | Converts (ASCII) characters to lowercase
109
- toOwned | Creates an owned slice of the String
110
- toUppercase | Converts (ASCII) characters to uppercase
111
- trim | Removes whitelist from both ends
112
- trimEnd | Remove whitelist from the end
113
- trimStart | Remove whitelist from the start
114
- truncate | Realloc to the length
115
- set_str | Set's buffer value from string literal
116
- writer | Returns a std.io.Writer for the String
117
- starts_with | Determines if the given string begins with the given value
118
- ends_with | Determines if the given string ends with the given value
119
- replace | Replace all occurrences of the search string with the replacement string
85
+ | Function | Description |
86
+ | ------------------ | ------------------------------------------------------------------------ |
87
+ | allocate | Sets the internal buffer size |
88
+ | capacity | Returns the capacity of the String |
89
+ | charAt | Returns character at index |
90
+ | clear | Clears the contents of the String |
91
+ | clone | Copies this string to a new one |
92
+ | cmp | Compares to string literal |
93
+ | concat | Appends a string literal to the end |
94
+ | deinit | De-allocates the String |
95
+ | find | Finds first string literal appearance |
96
+ | rfind | Finds last string literal appearance |
97
+ | init | Creates a String with an Allocator |
98
+ | init_with_contents | Creates a String with specified contents |
99
+ | insert | Inserts a character at an index |
100
+ | isEmpty | Checks if length is zero |
101
+ | iterator | Returns a StringIterator over the String |
102
+ | len | Returns count of characters stored |
103
+ | pop | Removes the last character |
104
+ | remove | Removes a character at an index |
105
+ | removeRange | Removes a range of characters |
106
+ | repeat | Repeats string n times |
107
+ | reverse | Reverses all the characters |
108
+ | split | Returns a slice based on delimiters |
109
+ | splitToString | Returns a String based on delimiters |
110
+ | str | Returns the String as a slice |
111
+ | substr | Creates a string from a range |
112
+ | toLowercase | Converts (ASCII) characters to lowercase |
113
+ | toOwned | Creates an owned slice of the String |
114
+ | toUppercase | Converts (ASCII) characters to uppercase |
115
+ | trim | Removes whitelist from both ends |
116
+ | trimEnd | Remove whitelist from the end |
117
+ | trimStart | Remove whitelist from the start |
118
+ | truncate | Realloc to the length |
119
+ | setStr | Set's buffer value from string literal |
120
+ | writer | Returns a std.io.Writer for the String |
121
+ | startsWith | Determines if the given string begins with the given value |
122
+ | endsWith | Determines if the given string ends with the given value |
123
+ | replace | Replace all occurrences of the search string with the replacement string |
0 commit comments