HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to JuliaVariablesData TypesOperatorsStringsArraysConditions (if / else)Loops (for / while)Functions
REFERENCE
📖 Overview
🖥️ Output
📦 Variables & Types
🔢 Numbers & Math
✍️ String
📚 Array & Dictionary
🔀 Condition & Loop
🧩 Function
Julia›Strings

Strings

Concatenation, interpolation, length (length), uppercase/lowercase, and search.

Simple enough for a 5-year-old to understand

Concatenation and interpolation

Strings are concatenated with * (not +!). The most readable way is embedding with $degisken.

Example code
1
name = "Alex"
2
println("Hello " * name)
Hello Alex (concatenation with *)
Output / InputHello Alex (concatenation with *)
3
println("Name: $name")
Name: Alex (embed with $)
Output / InputName: Alex (embed with $)
Output / Input
💡 Hint: String concatenation in Julia uses *, not +.

About this topic

Strings in Julia are immutable and UTF-8 encoded. Immutability means that when you transform a string, a new string is produced; you must assign the result somewhere.

Julia's most surprising string rule is the concatenation operator: the multiplication sign is used instead of the plus sign. There is a mathematical rationale for this — concatenation is non-commutative, and in mathematics, non-commutative operations are denoted by multiplication.

Interpolation syntax is done with a dollar sign. For a single variable, just writing its name is enough; if you want to include an expression, you use parentheses. This is both shorter than concatenation and performs conversion automatically.

What you will learn

  • Concatenating text
  • String interpolation
  • Measuring length
  • Results of Unicode indexing
  • String functions

Who is this for?

  • Researchers generating output and reports
  • Those trying to concatenate with plus
  • Those getting index errors in Turkish texts

When to use?

Chart labels, file names, and report lines are generated with string concatenation; interpolation is the most readable way.

Avoiding direct indexing in strings containing multibyte characters prevents unexpected errors.

Common mistakes

Wrong

ad = "Ayşe"
println("Merhaba " + ad)

In Julia, the multiplication sign is used for string concatenation instead of the plus; the plus operator is not defined for strings and a MethodError is thrown. The error message explicitly states this, but it is an unexpected choice for those coming from many languages.

Correct

ad = "Ayşe"
println("Merhaba " * ad)

Wrong

metin = "çilek"
println(metin[2])

Julia indexes strings byte-by-byte; since Turkish characters take up more than one byte, the second byte falls into the middle of a character and a StringIndexError is thrown. To iterate over characters, traversal functions should be used instead of indices.

Correct

metin = "çilek"
println(collect(metin)[2])

Wrong

metin = "merhaba"
uppercase(metin)
println(metin)

Since strings are immutable, the function does not change the original, it returns a new string. Because you didn't assign the result, the lowercase version is still printed to the screen. Ignoring the return value is a silent error.

Correct

metin = "merhaba"
metin = uppercase(metin)
println(metin)

Frequently asked questions

Why the multiplication sign for concatenation?

Because addition is commutative in mathematics, multiplication doesn't have to be. String concatenation is also non-commutative: when the order changes, the result changes. Julia preferred this consistency; it takes a few days to get used to, but the logic is sound.

How do I find the number of characters?

The length function returns the number of characters; while a separate function returns the number of bytes. In Turkish texts, the two are different and you need to know which one you need.

How to write multi-line strings?

Three double quotes are used. The indentation of the closing mark determines the indentation of the text, so the text you aligned in the source code looks neat in the output. It is useful for long descriptions and templates.

Summary

Concatenation is done with the multiplication sign.

Interpolation is written with the dollar sign.

Strings are indexed byte-by-byte.

Direct indexing in multibyte characters throws an error.

String functions return a new value.

HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code