Note that there are some explanatory texts on larger screens.

plurals
  1. POString contains any char array
    primarykey
    data
    text
    <p>My problem is that i want to check if a string contains one or more of three character arrays i set up, and for the most part i got it to work but for some weird reason one line doesn't want to work and i don't know what I'm doing wrong.</p> <p>The three arrays are </p> <p>a = a-f lowercase letters</p> <p>b = A-F capital letters</p> <p>c = 1-6 numbers</p> <p>the program works for: lowercase, capital, numeric, lowercase + numeric, capital + numeric and lowercase + capital + numeric, but what isn't working is lowercase+capital which is <code>(c.Any(x.Contains) == false &amp;&amp; a.Any(x.Contains) == true &amp;&amp; b.Any(x.Contains) == true)</code></p> <p>Code:</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { Char[] a = { 'a', 'b', 'c', 'd', 'e', 'f' }; Char[] b = { 'A', 'B', 'C', 'D', 'E', 'F' }; Char[] c = { '1', '2', '3', '4', '5', '6' }; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; if(textBox2.Text != "") { Char[] x = textBox2.Text.ToCharArray(); if (c.Any(x.Contains) == true &amp;&amp; a.Any(x.Contains) ==false &amp;&amp; b.Any(x.Contains)==false) { textBox1.Text = "num"; } else if (b.Any(x.Contains) == true &amp;&amp; c.Any(x.Contains) == false &amp;&amp; a.Any(x.Contains) ==false) { textBox1.Text = "cap"; } else if (a.Any(x.Contains) == true &amp;&amp; c.Any(x.Contains) == false &amp;&amp; c.Any(x.Contains) == false) { textBox1.Text = "low"; } else if (c.Any(x.Contains) == false &amp;&amp; a.Any(x.Contains) == true &amp;&amp; b.Any(x.Contains) == true) { textBox1.Text = "low&amp;cap"; } else if (a.Any(x.Contains) == true &amp;&amp; c.Any(x.Contains) == true &amp;&amp; b.Any(x.Contains) == false) { textBox1.Text = "low&amp;num"; } else if (b.Any(x.Contains) == true &amp;&amp; c.Any(x.Contains) == true &amp;&amp; a.Any(x.Contains) == false) { textBox1.Text = "cap&amp;num"; } else if (a.Any(x.Contains) == true &amp;&amp; b.Any(x.Contains) == true &amp;&amp; c.Any(x.Contains) == true) { textBox1.Text = "cap&amp;num&amp;low"; } } } private void Form1_Load(object sender, EventArgs e) { } } } </code></pre> <p>Thanks in forward</p> <p>EDIT</p> <p>Never mind, i just figured it out The program found the lowercase only option first and didn't bother to look further...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload