Created
August 6, 2015 22:54
-
-
Save Maslor/3b019046f2dd47e87ed2 to your computer and use it in GitHub Desktop.
Method that replaces a specified String by another one in all of the first String's extension. In this case, all instances of the letter "T" in the input string are replaced by "U"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.StringBuilder; | |
public class Bio { | |
public static String dnaToRna(String dna){ | |
StringBuilder strb = new StringBuilder(dna); | |
while(strb.indexOf("T") != -1) { | |
strb.replace(strb.indexOf("T"),strb.indexOf("T")+1,"U"); | |
} | |
String rna = strb.toString(); | |
return rna; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment