funcion para buscar caracter en una cadena. delphi

krd
20 de Mayo del 2004
hola, necesitaba una funcion para buscar un caracter dentro de una cadena. graciñas

armanuell
20 de Mayo del 2004
esta es una funcion de delphi y hace la busqueda de un determinado caracter en una cadena se llama "POS", sino encuentra te regresa 0 , en caso contrario la pocision en donde empieza el caractero sub-cadena a encontrar
espero te sirva:
Pos(caracter_a_buscar, cadena);

Mariano Ventaja
20 de Mayo del 2004
Header File

string.h

Category

Memory and String Manipulation Routines, Inline Routines, C++ Prototyped Routines

Prototype

char *strchr(const char *s, int c); /* C only */

const char *strchr(const char *s, int c); // C++ only
char *strchr( char *s, int c); // C++ only
wchar_t *wcschr(const wchar_t *s, int c);

unsigned char * _mbschr(const unsigned char *s, unsigned int c);

Description

Scans a string for the first occurrence of a given character.

strchr scans a string in the forward direction, looking for a specific character. strchr finds the first occurrence of the character c in the string s. The null-terminator is considered to be part of the string.

For example:

strchr(strs,0)

returns a pointer to the terminating null character of the string strs.

Return Value

strchr returns a pointer to the first occurrence of the character c in s; if c does not occur in s, strchr returns null.

Saludos,
Mariano http://www.c0d3rz.com.ar