Solved

strstr function problem

Posted on 2003-10-31
5
11,602 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:Genetic_Wolf
  • 3
5 Comments
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9661941
Java and JavaScript are two different languages.

What exactly does strchr do
0
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 50 total points
ID: 9661951

  ndx = sometextValue.indexOf(ch)

Vinny
0
 
LVL 3

Author Comment

by:Genetic_Wolf
ID: 9661952
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.

0
 
LVL 3

Author Comment

by:Genetic_Wolf
ID: 9661963
Vinny, indexof seem to provide the right alternative, but I can't read the value, why ?

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

0
 
LVL 3

Author Comment

by:Genetic_Wolf
ID: 9661981
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.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now