#include "chext.h" #include long find_last_pos(const char* where, char what) { long last_found_pos = -1; long index = 0; while ( where[index] != '\0' ) { if ( where[index] == what ) { last_found_pos = index; } ++index; } return last_found_pos; } const char* find_last(const char* where, char what) { const char* last_found = NULL; for( ; *where; ++where ) { if( *where == what ) last_found = where; } return last_found; } long string_length(const char* text) { long length = 0; while ( text[length++] ) ; return length - 1; } void string_copy(long length, const char* source, char* target) { for ( long index = 0; index < length && source[index]; ++index ) target[index] = source[index]; target[length] = '\0'; } void string_copy_ptr(long length, const char* source, char* target) { while ( length-- && *source ) *target++ = *source++; *target = '\0'; }