Giter Site home page Giter Site logo

themathewnorman / substring-search Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 2.19 MB

Search for words that contain a substring within a text file of words.

License: MIT License

HTML 16.31% PHP 70.62% CSS 13.07%
substring search text-file text web php startswith endswith contains string file words wordsearch starts ends with starts-with ends-with

substring-search's Introduction

Substring Search

Performs a case-insensitive search for words within a text file that contain, start with, or end with a specified substring.

Use

The word list file

The words list file should be a plaintext file with a single word per line.

Including within your project

To use, you must first include the search.list.php file within your project's code.

require "./php/search.list.php";  
$ListSearch = new ListSearch();

You can then call the searchTextList() function to return an array of results containing a particular substring like so.

$listFileLocation = "./example/words.txt";
$substring = "xy";

// An array of results that contained "xy".
$resultArray = $ListSearch->searchTextList($listFileLocation, $substring);

Where

  • $listFileLocation is the path to the file containing the list of words.
  • $substring is the substring you're looking for within each of the words contained within the word list file.

You may also specify whether or not you'd like to limit results to words that either contain, start, or end with the substring.

// An array of results that contain the specified substring (default).
$resultArray = $ListSearch->searchTextList($listFileLocation, $substring, "contains");

// An array of results that start with the specified substring.
$resultArray = $ListSearch->searchTextList($listFileLocation, $substring, "starts");

// An array of results that end with the specified substring.
$resultArray = $ListSearch->searchTextList($listFileLocation, $substring, "ends");

Author

License

This project is licensed under the MIT License - see the LICENSE file for details.

substring-search's People

Contributors

themathewnorman avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.