``````

In :

"A"

``````
``````

Out:

"A"

``````
``````

In :

"ACGT"

``````
``````

Out:

"ACGT"

``````
``````

In :

st = "ACGT"

``````
``````

Out:

"ACGT"

``````
``````

In :

length(st) # getting the length of a string

``````
``````

Out:

4

``````
``````

In :

"" # empty string (epsilon)

``````
``````

Out:

""

``````
``````

In :

length("")

``````
``````

Out:

0

``````
``````

In :

"ACGT"[rand(1:4)] # generating a random nucleotide

``````
``````

Out:

'G': ASCII/Unicode U+0047 (category Lu: Letter, uppercase)

``````
``````

In :

"ACGT"[rand(1:4)] # repeated invocations might yield different nucleotides

``````
``````

Out:

'C': ASCII/Unicode U+0043 (category Lu: Letter, uppercase)

``````
``````

In :

"ACGT"[rand(1:4)] # repeated invocations might yield different nucleotides

``````
``````

Out:

'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)

``````
``````

In :

"ACGT"[rand(1:4)] # repeated invocations might yield different nucleotides

``````
``````

Out:

'G': ASCII/Unicode U+0047 (category Lu: Letter, uppercase)

``````
``````

In :

"ACGT"[rand(1:4)] # repeated invocations might yield different nucleotides

``````
``````

Out:

'C': ASCII/Unicode U+0043 (category Lu: Letter, uppercase)

``````
``````

In :

# now I'll make a random nucleotide string by concatenating random nucleotides
st = join(["ACGT"[rand(1:4)] for _ in 1:40])

``````
``````

Out:

"ATCGGATTCGTAAGTTAGTCGGCAGGTACGCCTTTCGCTG"

``````
``````

In :

st[2:4] # substring from position 2 up to (not including) position 4

``````
``````

Out:

"TCG"

``````

In Julia, the lowest offset is 1! Unlike C, Java, Python, Go. But like R.

Also, ranges like `2:4` are inclusive at both ends. `2:4` asks for the part of the string from offset 2 through offset 4.

``````

In :

st[1:3] # prefix of length 3

``````
``````

Out:

"ATC"

``````
``````

In :

st[length(st)-2:length(st)] # suffix of length 3

``````
``````

Out:

"CTG"

``````
``````

In :

st[end-2:end] # another way of getting the suffix of length 3

``````
``````

Out:

"CTG"

``````
``````

In :

st1, st2 = "CAT", "ATAC"

``````
``````

Out:

("CAT", "ATAC")

``````
``````

In :

st1

``````
``````

Out:

"CAT"

``````
``````

In :

st2

``````
``````

Out:

"ATAC"

``````
``````

In :

st1 * st2 # concatenation of 2 strings

``````
``````

Out:

"CATATAC"

``````