Solved

strstr function problem

Posted on 2003-10-31
5
11,609 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generate Numbers in JQuery file 11 66
Jquery 2 23
jQuery Scroll To Top 5 40
Disable selected option from one select box when selected in another select box 26 45
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. …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

830 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