Hello Everyone,
I’ve question… How to add an additional value (string type) in item specific index of array (int32 type)?
The scenario is:
Additional Value: “SAME”
Type Array Var: Int32[] → [10,20,30]
One of final result example is: [10 | SAME, 20, 30]
Anyone can help me?
Thank in Advanced & Regards,
Brian
Yoichi
(Yoichi)
October 21, 2021, 4:16am
2
Hi,
We cannot add string value to Int32 array.
Can you share what you want to achieve at the end?
Regards,
1 Like
Oh right I just remembered. I’ve change the scenario like this:
The scenario is:
Type Additional Value: Int32 → 100, 200, 300 (in each different variable)
Type Array Var: Int32[] → [10,20,30]
One of final result example is: [10, 100, 20, 200, 30, 300]
How about this?
Yoichi
(Yoichi)
October 21, 2021, 4:35am
4
Hi,
If it’s mandatory to merge array as the above order, the following will help.
arr.Zip(arrAdd, Function(x,y) {x,y}).SelectMany(Function(x) x).ToArray()
If it’s not important about order, we can use Array.Copy or Concat method.
Regards,
1 Like
That isn’t mandatory, just one of my experiment to validating the data.
Your help is very useful for me, thank you very much.
Cheers
Hello,
Thank you for your help. I will definitely try that
Regards,
Brian
Yoichi
(Yoichi)
October 21, 2021, 8:44am
8
Hi,
That isn’t mandatory, just one of my experiment to validating the data.
Alright. The following will work, FYI
arr.Concat(arrAdd).ToArray()
Regards,
2 Likes