home *** CD-ROM | disk | FTP | other *** search
- // testing of more of the Characters category.
- #import <stdio.h>
- #import <stdlib.h>
- #import <signal.h>
- #import <fcntl.h>
- #import <string.h>
- #import <sys/time.h>
- #import <RCString.h>
-
- int
- main(int c, char **v)
- {
- RCString *oString;
- int iChar, iIndex;
-
- // args assumed to be: cmd string char index
- iChar = *v[2];
- iIndex = atoi(v[3]);
-
- oString = [RCString newFromString:v[1]];
- if (oString) {
- printf("substituting %c at index %d into \"%s\": \"%s\"\n",
- iChar, iIndex, v[1],
- [[oString substituteCharacter:iChar at:iIndex] data]);
-
- printf("inserting %c at index %d into \"%s\": \"%s\"\n",
- iChar, iIndex, v[1],
- [[[oString replaceWithAsciiString:v[1]] insertCharacter:iChar at:iIndex] data]);
- [oString free];
- } else {
- fprintf(stderr, "newFromString: failure\n");
- return(1);
- }
- return(0);
- }
-