Skip to content

the gb.h inside demo is outdate #32

@wanttobeno

Description

@wanttobeno

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;

}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions