Note that there are some explanatory texts on larger screens.

plurals
  1. POString Array Thing!
    text
    copied!<p>Right - to start with, I'm entering unfamiliar areas with this - so please be kind!</p> <p>I have a script that looks a little something like this:</p> <pre><code>Private Function checkString(ByVal strIn As String) As String Dim astrWords As String() = New String() {"bak", "log", "dfd"} Dim strOut As String = "" Dim strWord As String For Each strWord In astrWords If strIn.ToLower.IndexOf(strWord.ToLower, 0) &gt;= 0 Then strOut = strWord.ToLower Exit For End If Next Return strOut End Function </code></pre> <p>It's function is to check the input string and see if any of those 'astrWords' are in there and then return the value.</p> <p>So I wrote a bit of code to dynamically create those words that goes something like this:</p> <pre><code>Dim extensionArray As String = "" Dim count As Integer = 0 For Each item In lstExtentions.Items If count = 0 Then extensionArray = extensionArray &amp; """." &amp; item &amp; """" Else extensionArray = extensionArray &amp; ", ""." &amp; item &amp; """" End If count = count + 1 Next My.Settings.extensionArray = extensionArray My.Settings.Save() </code></pre> <p>Obviously - it's creating that same array using list items. The output of that code is exactly the same as if I hard coded it - but when I change the first bit of code to: Dim astrWords As String() = New String() {My.Settings.extensionArray} instead of: Dim astrWords As String() = New String() {"bak", "log", "dfd"} It starts looking for the whole statement instead of looping through each individual one?</p> <p>I think it has something to do with having brackets on the end of the word string - but I'm lost!</p> <p>Any help appreciated :)</p>
 

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