Link to home
Start Free TrialLog in
Avatar of Genetic_Wolf
Genetic_Wolf

asked on

strstr function problem

in Javascript, I have something like this:

p = strchr(sString, 64);

doesn't work, I also tried

var p = strchr(sString, 64);

doesn't work either.

Does STRSTR exist in Java ??  Or is there any equivalent ??

thanks.
Avatar of jaysolomon
jaysolomon

Java and JavaScript are two different languages.

What exactly does strchr do
ASKER CERTIFIED SOLUTION
Avatar of VincentPuglia
VincentPuglia

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Genetic_Wolf

ASKER

I was talking about STRSTR but  I think STRCHR do something similar.

Suppose we have:

p = strstr("Hello!", '!');

P = some pointer to '!' in the first string.

In VB we would say:

p = instr("Hello!", "!")
where p = 6 because VB doesn't return a pointer but a position.

But that's not my concern to me, I only want to check if a car is inside a sentence.

Vinny, indexof seem to provide the right alternative, but I can't read the value, why ?

I'm trying to find syntax or documentation...

Vinny, Alright, I found it,

The use of ' is forbiden, I must use "

something like:
[RIGHT]
ndx = sometextValue.indexOf("@")

instead of

[WRONG]
ndx = sometextValue.indexOf('@')
or
ndx = sometextValue.indexOf(64)

ref.: http://www.devguru.com/Technologies/ecmascript/quickref/string_indexof.html

Thanks.