Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the gb.h inside demo is outdate #32

Open
wanttobeno opened this issue May 6, 2018 · 1 comment
Open

the gb.h inside demo is outdate #32

wanttobeno opened this issue May 6, 2018 · 1 comment

Comments

@wanttobeno
Copy link

wanttobeno commented May 6, 2018

This is a demo, vs2017 is ok.

`
#define GB_IMPLEMENTATION
#include "gb.h"
#include <stdio.h>

int main(int argc, char **argv)
{
gbAllocator allocator = gb_heap_allocator();
gbString str = gb_string_make(allocator ,"Hello");

gbString other_str = gb_string_make_length(allocator,", ", 2);

str = gb_string_append(str, other_str);
str = gb_string_appendc(str, "world!");

gb_printf("%s\n", str); // Hello, world!

gb_printf("str length = %d\n", gb_string_length(str));

str = gb_string_set(str, "Potato soup");
gb_printf("%s\n", str); // Potato soup

str = gb_string_set(str, "Hello");
other_str = gb_string_set(other_str, "Pizza");
if (gb_string_are_equal(str, other_str))
	gb_printf("Not called\n");
else
	gb_printf("Called\n");

str = gb_string_set(str, "Ab.;!...AHello World       ??");
str = gb_string_trim(str, "Ab.;!. ?");
gb_printf("%s\n", str); // "Hello World"

gb_string_free(str);
gb_string_free(other_str);

return 0;

}
`

@gingerBill
Copy link
Owner

Please make a PR to change this 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants