Delimiting problems

From: Ess355 (ess355_at_hotmail.com)
Date: 03/31/04


Date: 31 Mar 2004 08:43:06 -0800

Hello all,

I've got a simple problem and a harder problem. Simple one first:

1) I can't get the character " and as a delimiter.

Here is what I have:
...
const char delimiters[] = " .,;:!,\r\n\t()";
...
currentword = strtok(string, delimiters);

I've tried putting the " character in two ' characters to delimit the
" character, but the compiler throws it out:

const char delimiters[] = " .,;:!,\r\n\t()'"'";

So how can I delimit the " character?

2) I'm trying to count the number of words and letters from a text
file. Now when I have a piece of string such as

government's

I don't want the ‘ character because I'm using the strlen() function
count the number of words only. If I delimit the ' character then the
string gets split in two and the s on the end of the string becomes a
separate word, i.e.

government s

So instead of counting one word, I‘ll count 2, which of course is
inaccurate of my program.

How can I get round these problems?

Thanks in advance :-)
Ess

PS: And just for experimenting purposes:

3) I want to filter out some words, this method doesn't seem to work,
even though it compiles alright:
...
  c = fgetc (TextFile);
  if (c=!('!'||' '||'.'||'\0')) n++;
...

I am try to avoid the characters .! etc. The program hangs when I try
it.

However when I tried this, it worked.

...
  c = fgetc (TextFile);
  if (c==A) n++;
...

Which would count the number of A's in the string.

I'm confused :-)



Relevant Pages

  • Re: ADO Recordset FIND problem
    ... That is the only character that can be confused with a string ... Keep in mind, if you use a double quote as a string delimiter, ... if you wish to use double quotes to delimit ...
    (microsoft.public.scripting.vbscript)
  • Re: sed usage question
    ... to delimit every line ending. ... I recall using old dot matrix printers in the early 80s. ... of a single character (and I recall CR doing the job, ... character to delimit the end of the line to save on storage costs. ...
    (uk.comp.sys.mac)
  • Re: Can an "Update" Query insert quotation marks around text?
    ... > quotes) is because the software is reacting to the presence of your quotes. ... > that text string is delimited by " characters within the software, ... > is not the beginning or end of a text string, but a literal " character. ... it's unusual to need to delimit a text string with " characters ...
    (microsoft.public.access.queries)
  • Re: Delimiting problems
    ... > So how can I delimit the " character? ... Now when I have a piece of string such as ... If you want to compare against several values, ...
    (comp.lang.c)
  • Re: How awk `split works?
    ... Why does awk work in ... Otherwise, if FS is any other character c, fields shall be ... the extended regular expression shall delimit fields. ...
    (comp.unix.shell)