Sha256: b64579a5e30ab79c181c76a7b07098d3e33ff280544d93ba2a16ae4429f1518f

Contents?: true

Size: 850 Bytes

Versions: 159

Compression:

Stored size: 850 Bytes

Contents

#import "RNATranscriptionExample.h"

@implementation RNATranscription

- (NSString *)rnaFromDNAStrand:(NSString *)dnaStrand
{
    NSDictionary *dnaToRNADict = @{ @"G" : @"C",
                                    @"C" : @"G",
                                    @"T" : @"A",
                                    @"A" : @"U" };

    NSMutableString *rnaStrand = [NSMutableString stringWithString:dnaStrand];

    for (NSUInteger i = 0; i < [dnaStrand length]; i++) {
        NSRange charRange = [dnaStrand rangeOfComposedCharacterSequenceAtIndex:i];
        NSString *dnaNucleotide = [dnaStrand substringWithRange:charRange];
        NSString *rnaNucleotide = dnaToRNADict[dnaNucleotide];
        if (!rnaNucleotide) return nil;
        [rnaStrand replaceCharactersInRange:charRange withString:rnaNucleotide];
    }

    return [rnaStrand copy];
}

@end

Version data entries

159 entries across 159 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.77 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.76 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.75 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.74 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.73 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.72 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.71 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.70 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.69 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.68 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.67 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.66 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.65 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.64 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.63 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.62 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.61 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.60 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.59 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m