Parse directories to be packages

This commit is contained in:
gingerBill committed 2018-05-21 20:47:52 +01:00
1 parent 718b80ba39
commit 5b6770f3d2
39 files changed
+1447 -1209

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
package strings
import "core:mem"
import "core:raw"
new_string :: proc(s: string) -> string {
c := make([]byte, len(s)+1);
copy(c, cast([]byte)s);
c[len(s)] = 0;
return string(c[..len(s)]);
}
new_cstring :: proc(s: string) -> cstring {
c := make([]byte, len(s)+1);
copy(c, cast([]byte)s);
c[len(s)] = 0;
return cstring(&c[0]);
}
@(deprecated="Please use a standard cast for cstring to string")
to_odin_string :: proc(str: cstring) -> string {
return string(str);
}
string_from_ptr :: proc(ptr: ^byte, len: int) -> string {
return transmute(string)raw.String{ptr, len};
}
contains_rune :: proc(s: string, r: rune) -> int {
for c, offset in s {
if c == r do return offset;
}
return -1;
}