Results 1 to 4 of 4

Thread: How to find a substring in a string?

  1. #1
    Join Date
    Sep 2012
    Posts
    22

    How to find a substring in a string?

    I want to write a code such that I would be able to find data on my Mac using the string name of the file or the folder. For example I have a file with string name as ‘27.5.2012/11:6:40 scooby 50:67:f0:e7:d9:1c N/A 0.0 0.0’. Now If I just type ‘50:67:f0:e7:d9:1c’, I want the whole string to appear. In other words, I want to make a code that will find part of string from my search. Can someone help me with it?

  2. #2
    Join Date
    Feb 2012
    Posts
    100

    Re: How to find a substring in a string?

    I have devised a code for your requirement, but I don’t think that it is much accurate. There is still need for some more work on it, but you can have it for now.


  3. #3
    Join Date
    Feb 2012
    Posts
    98

    Re: How to find a substring in a string?

    he code that Lennon Norris has provided works well but it faces one problem, which makes it go into loops sometimes. Even if the proper strings are found with desired sub strings, it again starts searching for them again and it shows same results again. I studied the concept and the logic behind the code that Lennon Norris devised and I designed my own code.


  4. #4
    Join Date
    Feb 2012
    Posts
    100

    Re: How to find a substring in a string?

    That was a good piece of code that you have provided Rashid, it actually works. But again it fails to find the strings which have more than one space in the MAC address. I think that it is the only big disadvantage of it. I have been playing around with the variable and found a breakthrough in it. I replaced some part of the code with my own statements. Now the code looks like this and it works for data with two spaces in MAC address.


Similar Threads

  1. Find data in a string
    By New ID in forum Software Development
    Replies: 5
    Last Post: 17-02-2010, 04:05 AM
  2. How to input variable in string.find method in C++
    By Caelaan in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 10:50 PM
  3. Find and Replace in JavaScript String
    By Wilbur in forum Software Development
    Replies: 5
    Last Post: 15-12-2009, 02:23 PM
  4. How to retrieve a substring in a string?
    By Protector in forum Software Development
    Replies: 3
    Last Post: 15-10-2009, 07:20 PM
  5. Find any file containing a string?
    By Calab in forum Vista Help
    Replies: 15
    Last Post: 06-11-2008, 03:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,883,085.40959 seconds with 16 queries