Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7749925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:09:28+00:00 2026-06-01T11:09:28+00:00

lets say we have a string[] array = {telekinesis, laureate, Allequalsfive, Indulgence}; and we

  • 0

lets say we have a

string[] array = {"telekinesis", "laureate", "Allequalsfive", "Indulgence"};

and we need to find a word within this array

normally we’d do following: (or use any similar method to find a string)

bool result = array.Contains("laureate"); // returns true

In my case, the word that I am searching for, may have errors in it (as the title suggests).

For example, I can’t distinguish a difference between letters “I”(large “i”) and “l”(small “L”) and “1”(number one).

Is there any way how I can find a word such as “Allequalsfive” or “A11equalsfive” or “AIIequalsfive”? (loose search) Normally result will be “false”.

If only I can specify to ignore some letters.. (the sequence is constant, other letters are constants).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:09:29+00:00Added an answer on June 1, 2026 at 11:09 am

    With the help of extension methods & Levenshtein Distance algorithm

    var array = new string[]{ "telekinesis", "laureate", 
                              "Allequalsfive", "Indulgence" };
    
    bool b = array.LooseContains("A11equalsfive", 2); //returns true
    

    –

    public static class UsefulExtensions
    {
        public static bool LooseContains(this IEnumerable<string> list, string word,int distance)
        {
            foreach (var s in list)
                if (s.LevenshteinDistance(word) <= distance) return true;
            return false;
        }
    
        //
        //http://www.merriampark.com/ldcsharp.htm
        //
        public static int LevenshteinDistance(this string s, string t)
        {
            int n = s.Length;
            int m = t.Length;
            int[,] d = new int[n + 1, m + 1];
    
            // Step 1
            if (n == 0)
                return m;
    
            if (m == 0)
                return n;
    
            // Step 2
            for (int i = 0; i <= n; d[i, 0] = i++){}
    
            for (int j = 0; j <= m; d[0, j] = j++){}
    
            // Step 3
            for (int i = 1; i <= n; i++)
            {
                //Step 4
                for (int j = 1; j <= m; j++)
                {
                    // Step 5
                    int cost = (char.ToUpperInvariant(t[j - 1]) == char.ToUpperInvariant(s[i - 1])) ? 0 : 1;
    
                    // Step 6
                    d[i, j] = Math.Min(
                        Math.Min(d[i - 1, j] + 1, d[i, j - 1] + 1),
                        d[i - 1, j - 1] + cost);
                }
            }
            // Step 7
            return d[n, m];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have an array like this: string [] Filelist = ... I
can anyone help me on this.Lets say I have this array of string e.g.
Lets say a have a string such as this one: string txt = Lore
Lets say I have this code: public void MyMethod(string Data, List<string> InputData) { //I
lets say I have a String like this [{ name : Ronald , firstname
Lets say I have string like this: String q = foo (one) bla (two)
I have an Array with some String objects lets say months. [October] [May] [July]
Lets say I have this array, int[] numbers = {1, 3, 4, 9, 2};
Lets say I have the string: MyNamespace.SubNameSpace.MyClassName How do I extract just everything after
So lets say I have an string like so. $pizza = 1,2,3,5-4,7; and what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.