Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #102732

Re: Finding the position of a character in a string.

From Ike Naar <ike@iceland.freeshell.org>
Newsgroups comp.lang.c
Subject Re: Finding the position of a character in a string.
Date 2017-01-29 21:49 +0000
Organization A noiseless patient Spider
Message-ID <slrn3vfso8sov8.jam.ike@iceland.freeshell.org> (permalink)
References <432459d7-dc1c-4c69-a197-3767764ddd7a@googlegroups.com>

Show all headers | View raw


On 2017-01-29, janus <emekamicro@gmail.com> wrote:
> Is there  a standard function for finding character index Or a better way that what I have below?
>
> 	 char *sop = "+-*/()=,.#<>[];";
> 	 char *chpos = strchr(sop, ch);
> 	 int idx = chpos == NULL ? -1 : chpos - sop;

strspn / strcspn ?

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Finding the position of a character in a string. janus <emekamicro@gmail.com> - 2017-01-29 10:10 -0800
  Re: Finding the position of a character in a string. fir <profesor.fir@gmail.com> - 2017-01-29 10:27 -0800
    Re: Finding the position of a character in a string. Chad <cdalten@gmail.com> - 2017-01-29 12:07 -0800
  Re: Finding the position of a character in a string. Ike Naar <ike@iceland.freeshell.org> - 2017-01-29 21:49 +0000

csiph-web