Skip to content
Lorhan Sohaky edited this page Feb 7, 2017 · 3 revisions

Welcome to the Dynamic String Wiki!

String *string_new(): Allocates a new String and returns it's pointer.

String *string_new_with_text( const char *text ): Allocates a new String, sets text for String and returns it's pointer.

String *string_new_with_size( unsigned int size ): Allocates a new String of size size and returns it's pointer.

bool string_copy_string( String *destination, const String *source ): Copies the text of source to destination. Returns a boolean indicating if the operation was successful or not.

bool string_copy_char_array( String *string, const char *text ): Copies the text of source to destination. Returns a boolean indicating if the operation was successful or not.

String *string_substring( const String *string, int beginIndex, int endIndex ): Returns a new string that is a substring of this string.

bool string_sprint( String *string, const char *format, ... ): Composes a string according to the format. Returns a boolean indicating if the operation was successful or not.

bool string_concat_string( String *destination, const String *source ): Appends source to the end of destination.

bool string_concat_char_array( String *destination, const char *source ): Appends source to the end of destination.

bool string_replace_first( String *string, const char *regex, const char *replacement ): Replaces the first occurence of the regex with replacement.

bool string_replace_all( String *string, const char *regex, const char *replacement ): Replaces each regex occurence on the string with replacement.

bool string_equals( const String *string1, const String *string2 ): Checks if Strings are equal.

bool string_equals_by_locale( const String *string1, const String *string2 ): Checks if Strings are equal by locale.

int string_compare( const String *string1, const String *string2 ): Compare strings, similar to strcmp.

int string_compare_by_locale( const String *string1, const String *string2 ): Compare strings by locale, similar to strcoll.

char string_char_at( const String *string, unsigned int index ): Returns the char value at the specified index.

bool string_set_text( String *string, const char *char_array ): Sets String text. Returns a boolean indicating if the operation was successful or not.

char *string_get_text( const String *string ): Gets String text.

int string_get_length( const String *string ): Gets String length.

bool string_is_empty( const String *string ): Checks if String is empty.

void string_free( String *string ): Releases the memory.

bool string_shrink_to_fit( String *string ): Reallocates the String to stored text length.

Clone this wiki locally