Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubSzark committed Apr 1, 2024
1 parent ae6b323 commit c6efbff
Showing 1 changed file with 45 additions and 41 deletions.
86 changes: 45 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

# Zig String (A UTF-8 String Library)

This library is a UTF-8 compatible **string** library for the **Zig** programming language.
This library is a UTF-8 compatible **string** library for the **Zig** programming language.
I made this for the sole purpose to further my experience and understanding of zig.
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.

# Basic Usage

```zig
const String = @import("./zig-string.zig").String;
// ...
Expand All @@ -30,6 +31,7 @@ assert(myString.cmp("🔥 Hello, World 🔥"));
```

# Installation

Add this to your build.zig.zon

```zig
Expand Down Expand Up @@ -59,14 +61,15 @@ You can then import the library into your code like this
const String = @import("string").String;
```


# Things needed

- Optimizations
- Multi-Language toUppercase & toLowercase
- Better documentation
- More Testing

# How to Contribute

1. Fork
2. Clone
3. Add Features (Use Zig FMT)
Expand All @@ -75,45 +78,46 @@ const String = @import("string").String;
6. Success!

# Working Features

If there are any issues with <b>complexity</b> please <b>open an issue</b>
(I'm no expert when it comes to complexity)

Function | Description
--------------|------------------------------------------
allocate | Sets the internal buffer size
capacity | Returns the capacity of the String
charAt | Returns character at index
clear | Clears the contents of the String
clone | Copies this string to a new one
cmp | Compares to string literal
concat | Appends a string literal to the end
deinit | De-allocates the String
find | Finds first string literal appearance
rfind | Finds last string literal appearance
init | Creates a String with an Allocator
init_with_contents| Creates a String with specified contents
insert | Inserts a character at an index
isEmpty | Checks if length is zero
iterator | Returns a StringIterator over the String
len | Returns count of characters stored
pop | Removes the last character
remove | Removes a character at an index
removeRange | Removes a range of characters
repeat | Repeats string n times
reverse | Reverses all the characters
split | Returns a slice based on delimiters
splitToString | Returns a String based on delimiters
str | Returns the String as a slice
substr | Creates a string from a range
toLowercase | Converts (ASCII) characters to lowercase
toOwned | Creates an owned slice of the String
toUppercase | Converts (ASCII) characters to uppercase
trim | Removes whitelist from both ends
trimEnd | Remove whitelist from the end
trimStart | Remove whitelist from the start
truncate | Realloc to the length
set_str | Set's buffer value from string literal
writer | Returns a std.io.Writer for the String
starts_with | Determines if the given string begins with the given value
ends_with | Determines if the given string ends with the given value
replace | Replace all occurrences of the search string with the replacement string
| Function | Description |
| ------------------ | ------------------------------------------------------------------------ |
| allocate | Sets the internal buffer size |
| capacity | Returns the capacity of the String |
| charAt | Returns character at index |
| clear | Clears the contents of the String |
| clone | Copies this string to a new one |
| cmp | Compares to string literal |
| concat | Appends a string literal to the end |
| deinit | De-allocates the String |
| find | Finds first string literal appearance |
| rfind | Finds last string literal appearance |
| init | Creates a String with an Allocator |
| init_with_contents | Creates a String with specified contents |
| insert | Inserts a character at an index |
| isEmpty | Checks if length is zero |
| iterator | Returns a StringIterator over the String |
| len | Returns count of characters stored |
| pop | Removes the last character |
| remove | Removes a character at an index |
| removeRange | Removes a range of characters |
| repeat | Repeats string n times |
| reverse | Reverses all the characters |
| split | Returns a slice based on delimiters |
| splitToString | Returns a String based on delimiters |
| str | Returns the String as a slice |
| substr | Creates a string from a range |
| toLowercase | Converts (ASCII) characters to lowercase |
| toOwned | Creates an owned slice of the String |
| toUppercase | Converts (ASCII) characters to uppercase |
| trim | Removes whitelist from both ends |
| trimEnd | Remove whitelist from the end |
| trimStart | Remove whitelist from the start |
| truncate | Realloc to the length |
| setStr | Set's buffer value from string literal |
| writer | Returns a std.io.Writer for the String |
| startsWith | Determines if the given string begins with the given value |
| endsWith | Determines if the given string ends with the given value |
| replace | Replace all occurrences of the search string with the replacement string |

0 comments on commit c6efbff

Please sign in to comment.