Check if element in array is Null / Excel VBA [duplicate] - arrays

This question already has answers here:
How to check for Is Not Null in VBA?
(2 answers)
Closed 7 years ago.
While retrieving data from a database into an array one of my array elements is (or appears to be) 'Null', as the watch window shows.
However, pCurveDefinitions(2,0)=Null return FALSE.
How can I make the check in such a way it returns TRUE?

This is just a different test, like IsError, you should use IsNull(pCurveDefinitions(2,0))!

Related

Get a specific value of a string_split in MSSQL [duplicate]

This question already has answers here:
Using T-SQL, return nth delimited element from a string
(14 answers)
Split string and take last element
(15 answers)
Closed 2 months ago.
I have a string like this
0011.06.123.7-0
SELECT STRING_SPLIT(NUMBER,'.')
returns
Values
0011
06
123
And now I only and always need the third value, in this case '123'
How do I select this proberly?
I already tried to get the third value with the Rownumber, but that didn't worked out.

Find the only difference between two arrays in Ruby [duplicate]

This question already has answers here:
Find number deleted from array
(2 answers)
Closed 5 years ago.
I have two arrays a and b. a always has one element more than b, and the arrays are mixed.
a = [1,5,7,2,4]
b = [2,4,7,1]
I want to find the extra element in a. The output should be 5.
What is the best approach in ruby? Is it good idea to use loop?
I think this is the best built-in function to get what you expect
(a - b).pop

How to check if one array has exactly the same elements as another (with duplicates) and in any order [duplicate]

This question already has answers here:
Check if elements in two arrays are same irrespective of index
(2 answers)
How do I check in Swift if two arrays contain the same elements regardless of the order in which those elements appear in?
(10 answers)
Closed 5 years ago.
I tried using sets but obviously that doesn't work. I need a function to be able to work like this:
let Array1 = [2,2,1,1]
let Array2 = [2,1,2,1]
let Array3 = [2,2,2,1]
I need my function to be able to recognize that Array1 and Array2 are equal without thinking that Array3 is the same. Any thoughts?

Combine values of two arrays to form key and values to hash in ruby [duplicate]

This question already has answers here:
Combine two Arrays into Hash
(8 answers)
Closed 6 years ago.
If i have two arrays containing about 20 separate values is it possible to combine the two into a hash? With the contents of one array acting as the keys and the other as the values?
Sure, very simple
Hash[[1,2,3,4].zip([5,6,7,8])]
=> {1=>5, 2=>6, 3=>7, 4=>8}
But it might be a problem if the arrays have not the same size.

(Ruby)Select an element in the array randomly [duplicate]

This question already has answers here:
How do I pick randomly from an array?
(7 answers)
Closed 7 years ago.
Select a element in the array randomly WITHOUT using the Random class.
id={1,2,3,4,5}
Is there any method which belongs to the Array class that is used to randomly select an element?
You can use the sample method
[:foo, :bar].sample # => :foo, or :bar :-)
Credit this SO question/answer

Resources