Common string operations.
Go to the source code of this file.
Functions | |
| int | SC68strcmp (const char *a, const char *b) |
| Compare two string (case insensitive). | |
| char * | SC68strcat (char *a, const char *b, int l) |
| Concatenate two strings. | |
| char * | SC68strdup (const char *s) |
| Duplicate a string. | |
| char * | SC68strcatdup (const char *a, const char *b) |
| Concat two strings in a duplicate buffer. | |
| char * | SC68time_str (char *buffer, int track_num, int seconds) |
| Make a track and time infornmation string. | |
| char * | SC68long_time_str (char *buffer, int time) |
| Convert time (in second) to string. | |
| int SC68strcmp | ( | const char * | a, | |
| const char * | b | |||
| ) |
Compare two string (case insensitive).
The SC68strcmp() function compares the two strings a and b, ignoring the case of the characters. It returns an integer less than, equal to, or greater than zero if a is found, respectively, to be less than, to match, or be greater than b.
| a | First string to compare | |
| b | String to compare with |
| 0 | a and b are equal | |
| <0 | a is less than b | |
| >0 | a is greater than b |
| char* SC68strcat | ( | char * | a, | |
| const char * | b, | |||
| int | l | |||
| ) |
Concatenate two strings.
The SC68strcat() function appends the b string to the a string overwriting the 0 character at the end of dest, and then adds a terminating 0 character. The strings may not overlap. Destination string has a maximum size of l characters. On overflow, the trailing 0 is omitted.
| a | Destination string | |
| b | String to append. | |
| l | Destination maximum size (including trailing 0) |
| a |
| char* SC68strdup | ( | const char * | s | ) |
Duplicate a string.
The SC68strdup() function returns a pointer to a new string which is a duplicate of the string s. Memory for the new string is obtained with SC68alloc(), and can be freed with SC68free().
| s | String to duplicate. |
0 error
| char* SC68strcatdup | ( | const char * | a, | |
| const char * | b | |||
| ) |
Concat two strings in a duplicate buffer.
The SC68strcatdup() function returns a pointer to a new string which is a duplicate of the string a+b. Memory for the new string is obtained with SC68alloc(), and can be freed with SC68free(). If either a or b is null the function does not failed but replace it by an empty string. If both a and b are null the function returns 0.
| a | Left string. | |
| b | right string. |
0 error
| char* SC68time_str | ( | char * | buffer, | |
| int | track_num, | |||
| int | seconds | |||
| ) |
Make a track and time infornmation string.
The SC68time_str() function formats a string with track time info. The general format is "TK MN:SS" where:
| buffer | Destination buffer (0 use default static buffer). | |
| track_num | Track number from 00 to 99, minus values disable. | |
| seconds | Time to display in seconds [00..5999], other values disable. |
Not thread safe.
| char* SC68long_time_str | ( | char * | buffer, | |
| int | time | |||
| ) |
Convert time (in second) to string.
The SC68long_time_str() function converts a time in seconds to days, hours, minutes and second string. Day and hour unit are removed if they are null (not signifiant). The output string looks like : [D days, ][H h, ] MN' SS"
| buffer | Destination buffer (0 use default static buffer). | |
| time | Time in second to convert to string. |
1.5.2