Update of /cvsroot/refdb/refdb/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14220/src
Modified Files:
Tag: Release_0_9_5_stable
strfncs.c strfncs.h
Log Message:
new function stricap()
Index: strfncs.c
===================================================================
RCS file: /cvsroot/refdb/refdb/src/strfncs.c,v
retrieving revision 1.15.2.1
retrieving revision 1.15.2.2
diff -u -U2 -r1.15.2.1 -r1.15.2.2
--- strfncs.c 6 May 2004 21:59:15 -0000 1.15.2.1
+++ strfncs.c 23 Jul 2004 02:02:07 -0000 1.15.2.2
@@ -340,4 +340,37 @@
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ stricap(): converts a string in place to lowercase, but capitalize
+ the first letter of each word
+
+ char* stricap() returns a pointer to the modified string
+
+ char* string pointer to the string to be converted
+
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+char* stricap(char* string) {
+ char* period;
+
+ strdn(string);
+ /* now uppercase the first character of each word unless it is something like "the", "a" etc. */
+
+ /* ToDo: handle the "the", "a" etc. cases */
+ period = string;
+ if (islower((int)(*period))) {
+ *period = (char)toupper((int)(*period));
+ }
+ period++;
+ while (*period != '\0') {
+ if (ispunct((int)(*period)) || isspace((int)(*period))) {
+ if (islower((int)(*(period+1)))) {
+ *(period+1) = (char)toupper((int)(*(period+1)));
+ }
+ }
+ period++;
+ }
+
+ return string;
+}
+
+/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
compare_ptr(): compares two pointers to strings
Index: strfncs.h
===================================================================
RCS file: /cvsroot/refdb/refdb/src/strfncs.h,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -U2 -r1.8 -r1.8.2.1
--- strfncs.h 29 Jun 2003 23:09:01 -0000 1.8
+++ strfncs.h 23 Jul 2004 02:02:07 -0000 1.8.2.1
@@ -54,4 +54,5 @@
char* strup(char* string);
char* strdn(char* string);
+char* stricap(char* string);
int compare_ptr(void* ptr_one, void* ptr_two);
char* mstrcat(char* destination, char* source, size_t* ptr_dest_len, size_t offset);
|