?
Solved

strstr function problem

Posted on 2003-10-31
5
Medium Priority
?
11,620 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
Suggested Courses

801 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