Solved

strstr function problem

Posted on 2003-10-31
5
11,598 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
Comment Utility
Java and JavaScript are two different languages.

What exactly does strchr do
0
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 50 total points
Comment Utility

  ndx = sometextValue.indexOf(ch)

Vinny
0
 
LVL 3

Author Comment

by:Genetic_Wolf
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

744 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

15 Experts available now in Live!

Get 1:1 Help Now