© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
25 replies
Rype

Sharing elements of 2 arrays into another array

So i got a char array that consists of the chars ATG AAA GGG TAG ATG AAA TAG ATG TGT TTG TAT TAG
and another char array that consists of chars
*ATG* CCC *TAG* *ATG* AAA CTA *TAG* *ATG* GGG *TAG* *ATG* GGG GCG CCG *TAG* *ATG* CCG CCG CCG *TAG*
*ATG* CCC *TAG* *ATG* AAA CTA *TAG* *ATG* GGG *TAG* *ATG* GGG GCG CCG *TAG* *ATG* CCG CCG CCG *TAG*

(no char that is blank(' ') - the spaces and are to show significance of ATG and TAG)

What i want to do:

I have a 3rd char array and i want to share one gene from first array(if any) and one from second array(if any) - and skip the corresponding gene from other array if i already shared a gene from the other array. If other array has no corresponding gene, share all remaining genes without skipping.
One gene starts with ATG and ends with TAG.

The third array should look like ATG AAA GGG TAG
*ATG* AAA CTA *TAG*
*ATG* AAA CTA *TAG*
ATG TGT TTG TAT TAG
*ATG* GGG *TAG* *ATG* GGG GCG CCG *TAG* *ATG* CCG CCG CCG *TAG*
*ATG* GGG *TAG* *ATG* GGG GCG CCG *TAG* *ATG* CCG CCG CCG *TAG*


There's no chance of two ATGs or TAGs stacking in the arrays, i have taken care of it. So maybe just taking care of TAG will be enough.

I tried everything, the code was messy and didn't work under most conditions. Is there an easy way to do this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Split Lines into Array Elements
C#CC# / help
3y ago
The program should connect 2 sorted arrays into 1 sorted array
C#CC# / help
2y ago
Use of inline arrays to model arrays of structs
C#CC# / help
6mo ago