ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-1.0/libmdtools/StringUtils.c
(Generate patch)

Comparing trunk/OOPSE-1.0/libmdtools/StringUtils.c (file contents):
Revision 1334 by gezelter, Fri Jul 16 18:58:03 2004 UTC vs.
Revision 1419 by gezelter, Tue Jul 27 18:14:16 2004 UTC

# Line 1 | Line 1
1   #include <stdio.h>
2   #include <math.h>
3   #include <stdlib.h>
4 + #include <ctype.h>
5 + #include <string.h>
6   #include "simError.h"
7   #include "StringUtils.h"
8  
# Line 89 | Line 91 | int isEndLine(char *line) {
91   return 0;
92   }
93  
92
93 int count_tokens(char *line, char *delimiters) {
94  /* PURPOSE: RETURN A COUNT OF THE NUMBER OF TOKENS ON THE LINE. */
95
96  char *working_line;   /* WORKING COPY OF LINE. */
97  int ntokens;          /* NUMBER OF TOKENS FOUND IN LINE. */
98  char *strtok_ptr;     /* POINTER FOR STRTOK. */
99
100  strtok_ptr= working_line= strdup(line);
101
102  ntokens=0;
103  while (strtok(strtok_ptr,delimiters)!=NULL)
104    {
105      ntokens++;
106      strtok_ptr=NULL;
107    }
108
109  free(working_line);
110  return(ntokens);
111 }
112
94   /**
95   * Removes left and right spaces from a string
96   *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines