CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: search function

  1. #1
    Join Date
    Jan 2002
    Posts
    6

    search function

    Dear friends
    a very small queation. I am trying to search "."(dot) in a string which is an IP address through search() function in java script but it is not returning me right index. How to do it .

    The code is as follows :
    var IP = "10.0.1.140"
    var index= IP.search(".")

    it is always returns 0

    Regards ashwani

    [Goodz13:Moved from Java Forum]
    Last edited by Goodz13; January 10th, 2003 at 11:31 AM.

  2. #2
    Join Date
    Mar 2002
    Posts
    132
    First of all javascript is different from java. There is a seperate forum for javascript.
    For your question.
    use
    indexOf() function, se the link for detail
    http://wp.netscape.com/eng/mozilla/3...ef_h-l.htm#360

  3. #3
    Join Date
    Aug 2002
    Location
    Reykjavik, Iceland
    Posts
    201
    saddysans is correct. Use the indexOf() method.

    Also, you should not declare a variable with the name "index" as that is a reserved word in JavaScript.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured