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.58 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.57 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.56 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.55 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.54 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.53 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.52 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.51 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.50 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.49 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.48 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.47 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.46 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.45 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.44 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.43 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.42 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.41 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.40 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m
trackler-2.2.1.39 tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m