Note that there are some explanatory texts on larger screens.

plurals
  1. POFind the length of a word in an array - Visual Basic
    primarykey
    data
    text
    <p>I have a richtextbox and I converted the words to an array, then I have code that will take the length and the output it... only problem is I don't know how to loop through all the different values of the array to check the length of each individual part of the array. </p> <p>(I have this set on TextChanged) </p> <pre><code> Dim len1, len2, len3, len4, len5, len6, len7, len8, len9, len10, len11, len12, len13, len14, len15 As Integer Dim input As String Dim words As String() Dim length As Integer input = RichTextBox1.Text words = input.Split(New String() {" "}, StringSplitOptions.RemoveEmptyEntries) For Each w In words length = Len(w) Select Case length Case 1 len1 = len1 + 1 Case 2 len2 = len2 + 1 Case 3 len3 = len3 + 1 Case 4 len4 = len4 + 1 Case 5 len5 = len5 + 1 Case 6 len6 = len6 + 1 Case 7 len7 = len7 + 1 Case 8 len8 = len8 + 1 Case 9 len9 = len9 + 1 Case 10 len10 = len10 + 1 Case 11 len11 = len11 + 1 Case 12 len12 = len12 + 1 Case 13 len13 = len13 + 1 Case 14 len14 = len14 + 1 Case 15 len15 = len15 + 1 End Select Next letcount.onelet.Text = Val(len1) letcount.twolet.Text = Val(len2) letcount.threelet.Text = Val(len3) letcount.fourlet.Text = Val(len4) letcount.fivelet.Text = Val(len5) letcount.sixlet.Text = Val(len6) letcount.sevenlet.Text = Val(len7) letcount.eightlet.Text = Val(len8) letcount.ninelet.Text = Val(len9) letcount.tenlet.Text = Val(len10) letcount.elevenlet.Text = Val(len11) letcount.twelevelet.Text = Val(len12) letcount.thirteenlet.Text = Val(len13) letcount.fourteenlet.Text = Val(len14) letcount.fifteenlet.Text = Val(len15) </code></pre>
    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.
 

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