# \#strings

**URL:** https://discourse.julialang.org/tag/strings/73.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [StaticStrings.jl v0.3, move to JuliaStrings](https://discourse.julialang.org/t/staticstrings-jl-v0-3-move-to-juliastrings/139648)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 7\
**Last updated:** [September 25, 2026, 8:54am UTC](https://discourse.julialang.org/t/staticstrings-jl-v0-3-move-to-juliastrings/139648 "2026-09-25T08:54:42Z")

</div>

StaticStrings v0.3.0 StaticStrings.jl v0.3 was just released and has joined the JuliaStrings Github organization. Special thanks to @PatrickHaecker for major contributions to this release. StaticStrings.jl contains seve…

---

## [Non-allocating way to parse section of string as number?](https://discourse.julialang.org/t/non-allocating-way-to-parse-section-of-string-as-number/137672)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 2\
**Last updated:** [June 17, 2026, 8:31pm UTC](https://discourse.julialang.org/t/non-allocating-way-to-parse-section-of-string-as-number/137672 "2026-06-17T20:31:57Z")

</div>

Given a big string with numbers in it like input = ";(,)\<mul(595,110)~ #(select()-?who():mul(732,729)+/;%@mul(924,700)" and I know at execution time exactly where a number is in the string, I can parse that section of …

---

## [How to get file encoding?](https://discourse.julialang.org/t/how-to-get-file-encoding/72325)

<div class="topic-metadata">

**Author:** [@mathdeep](https://discourse.julialang.org/u/mathdeep)\
**Replies:** 5\
**Last updated:** [March 24, 2026, 9:54am UTC](https://discourse.julialang.org/t/how-to-get-file-encoding/72325 "2026-03-24T09:54:46Z")

</div>

Hi there, Is there a way to find out how a file is encoded with functions? I’m getting a text file and want to do sume stuff. In order to do right stuff, I have to know how the file is encoded, but I can’t find how to …

---

## [Typstry.jl: The Julia to Typst Interface](https://discourse.julialang.org/t/typstry-jl-the-julia-to-typst-interface/114381)

<div class="topic-metadata">

**Author:** [@jakobjpeters](https://discourse.julialang.org/u/jakobjpeters)\
**Replies:** 13\
**Last updated:** [February 26, 2026, 8:01pm UTC](https://discourse.julialang.org/t/typstry-jl-the-julia-to-typst-interface/114381 "2026-02-26T20:01:38Z")

</div>

Introduction Hi everyone! I’m excited to announce Typstry.jl, which helps you create Typst formatted strings and render documents from Julia. If you are familiar with LaTeXStrings.jl and Latexify.jl, then Typstry.jl aims…

---

## [Producing Strings with split()](https://discourse.julialang.org/t/producing-strings-with-split/134954)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 4\
**Last updated:** [January 8, 2026, 5:29pm UTC](https://discourse.julialang.org/t/producing-strings-with-split/134954 "2026-01-08T17:29:34Z")

</div>

Hi, I would like to avoid getting SubStrings. While the first split can be “fixed”, it “fails” at the second split and I don’t get why. julia\> txt = "a b c-aa bb cc-aaa bbb ccc" "a b c-aa bb cc-aaa bbb ccc" julia\> li…

---

## [Int -\> Str -\> print(io,\_) without allocations](https://discourse.julialang.org/t/int-str-print-io-without-allocations/134626)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 16\
**Last updated:** [December 19, 2025, 11:53am UTC](https://discourse.julialang.org/t/int-str-print-io-without-allocations/134626 "2025-12-19T11:53:12Z")

</div>

I have billions of Ints that I wish to write to a file. Something similar to mmwrite() in MatrixMarket.jl. I am already using IOBuffer with a large enough sizehint. When I do print(io, n::Int), behind the scenes, a conve…

---

## [Python's replace faster than Julia's replace?](https://discourse.julialang.org/t/pythons-replace-faster-than-julias-replace/63180)

<div class="topic-metadata">

**Author:** [@alasaadstat](https://discourse.julialang.org/u/alasaadstat)\
**Replies:** 22\
**Last updated:** [October 7, 2025, 10:50pm UTC](https://discourse.julialang.org/t/pythons-replace-faster-than-julias-replace/63180 "2025-10-07T22:50:46Z")

</div>

Hi, I am currently working on regex stuffs, and I noticed that Python’s replace seems to be faster than Julia’s replace. function test(iter=100\_000) for \_ in 1:iter replace("The quick foxes run quickly.", r"…

---

## [Is it possible to define '+' operator for string as '\*' do for them?](https://discourse.julialang.org/t/is-it-possible-to-define-operator-for-string-as-do-for-them/131835)

<div class="topic-metadata">

**Author:** [@psalm1750](https://discourse.julialang.org/u/psalm1750)\
**Replies:** 12\
**Last updated:** [August 26, 2025, 1:29pm UTC](https://discourse.julialang.org/t/is-it-possible-to-define-operator-for-string-as-do-for-them/131835 "2025-08-26T13:29:30Z")

</div>

I’d like to use ‘+’ operator for string concatenation. but it is ‘\*’ in Julia. If possible I’d like to define ‘+’ as alias of ‘\*’ if opland are strings. because some insufficient definition cause some side effect. Th…

---

## [String line continuation](https://discourse.julialang.org/t/string-line-continuation/130757)

<div class="topic-metadata">

**Author:** [@rokke](https://discourse.julialang.org/u/rokke)\
**Replies:** 14\
**Last updated:** [July 15, 2025, 9:01pm UTC](https://discourse.julialang.org/t/string-line-continuation/130757 "2025-07-15T21:01:05Z")

</div>

the docs make it sound like you can continue strings: “long lines can be broken up” but it’s giving me an error in the repl: julia\> "This is a long \\ ERROR: ParseError: # Error @ REPL\[1\]:1:17 "This is a long \\ # …

---

## [How to undo \`unsafe\_string\` call](https://discourse.julialang.org/t/how-to-undo-unsafe-string-call/130605)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 1\
**Last updated:** [July 10, 2025, 11:57am UTC](https://discourse.julialang.org/t/how-to-undo-unsafe-string-call/130605 "2025-07-10T11:57:09Z")

</div>

I’m using a library (Instruments.jl) that does a bunch of ccalls to return a string. It does this by calling unsafe\_string(pointer(buf)) where buf isa Vector{UInt8}. Can I undo this call to unsafe\_string to just get th…

---

## [\[ANN\] Gettext.jl 1.0 (new and improved) — translating Julia software](https://discourse.julialang.org/t/ann-gettext-jl-1-0-new-and-improved-translating-julia-software/130566)

<div class="topic-metadata">

**Author:** [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Replies:** 0\
**Last updated:** [July 9, 2025, 4:55am UTC](https://discourse.julialang.org/t/ann-gettext-jl-1-0-new-and-improved-translating-julia-software/130566 "2025-07-09T04:55:53Z")

</div>

Gettext.jl offers facilities for internationalization and localization (i18n and l10n) of software in the Julia programming language, using the standard gettext system. Essentially, Gettext allows the programmer to mark…

---

## [Escaping newlines in multi-line string macros?](https://discourse.julialang.org/t/escaping-newlines-in-multi-line-string-macros/129240)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 3\
**Last updated:** [May 23, 2025, 6:37am UTC](https://discourse.julialang.org/t/escaping-newlines-in-multi-line-string-macros/129240 "2025-05-23T06:37:41Z")

</div>

Would this feature, to be able to write a single string literal on multiple lines of the source code without \\n in the string, be eventually implemented for all string-like objects? I was surprised that it doesn’t wor…

---

## [How to use protected characters in a string (e.g. percent in printf)](https://discourse.julialang.org/t/how-to-use-protected-characters-in-a-string-e-g-percent-in-printf/67239)

<div class="topic-metadata">

**Author:** [@hdcpereira](https://discourse.julialang.org/u/hdcpereira)\
**Replies:** 1\
**Last updated:** [August 28, 2021, 6:25pm UTC](https://discourse.julialang.org/t/how-to-use-protected-characters-in-a-string-e-g-percent-in-printf/67239 "2021-08-28T18:25:41Z")

</div>

Hello there. How do I use these protected characters when writing a string? @printf "this code has failed in %.2f" fail\_percentage I would like the output to be this code has failed in 10.00% but when I use the % sy…

---

## [Redesigning String, optimising small strings and comparison](https://discourse.julialang.org/t/redesigning-string-optimising-small-strings-and-comparison/119716)

<div class="topic-metadata">

**Author:** [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Replies:** 71\
**Last updated:** [May 3, 2025, 6:26am UTC](https://discourse.julialang.org/t/redesigning-string-optimising-small-strings-and-comparison/119716 "2025-05-03T06:26:33Z")

</div>

Whenever I’ve had to do large-scale string work in Julia, I tend to be less impressed with performance than when doing numerical work. This has produced a niggle, and that niggle as lead to some investigation, which has …

---

## [Turning a string containing Unicode code points to a normal string](https://discourse.julialang.org/t/turning-a-string-containing-unicode-code-points-to-a-normal-string/126273)

<div class="topic-metadata">

**Author:** [@lance\_xwq](https://discourse.julialang.org/u/lance_xwq)\
**Replies:** 2\
**Last updated:** [February 24, 2025, 11:03pm UTC](https://discourse.julialang.org/t/turning-a-string-containing-unicode-code-points-to-a-normal-string/126273 "2025-02-24T23:03:20Z")

</div>

For example, given that '\\u03BC' is 'μ', how should I turn "\\\\u03BCm" to "μm"? Thanks for any suggestions!

---

## [Extracting dates and values from a string](https://discourse.julialang.org/t/extracting-dates-and-values-from-a-string/125401)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 9\
**Last updated:** [January 30, 2025, 10:02pm UTC](https://discourse.julialang.org/t/extracting-dates-and-values-from-a-string/125401 "2025-01-30T22:02:50Z")

</div>

I would appreciation any guidance. I have the text below and would like to extract all dates and the associated information within “dataX.push()” to end up with for instance: 2023-01-10, 0.0, 0.0, 0.0, 0.0; 2023-01-11, 0…

---

## [Why are concatenated String15's promoted to String31?](https://discourse.julialang.org/t/why-are-concatenated-string15s-promoted-to-string31/124686)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 2\
**Last updated:** [January 12, 2025, 12:27am UTC](https://discourse.julialang.org/t/why-are-concatenated-string15s-promoted-to-string31/124686 "2025-01-12T00:27:11Z")

</div>

I found this bug (I guess it is mine) when trying to @reset an element of an SVector{String15} after updating Accessors from 0.1.38 to 0.1.39, but not sure why it used to work. MWE: julia\> using InlineStrings julia\> x…

---

## [Palindrome](https://discourse.julialang.org/t/palindrome/124054)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 19\
**Last updated:** [December 27, 2024, 6:20am UTC](https://discourse.julialang.org/t/palindrome/124054 "2024-12-27T06:20:14Z")

</div>

Hello, I want to write a program that determines whether a sentence is a palindrome or not. I wrote the following program and it works, but I want to know if this piece of code is flawed from a programming science persp…

---

## [How do I find the number of bytes for a character?](https://discourse.julialang.org/t/how-do-i-find-the-number-of-bytes-for-a-character/124144)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 3\
**Last updated:** [December 24, 2024, 4:48pm UTC](https://discourse.julialang.org/t/how-do-i-find-the-number-of-bytes-for-a-character/124144 "2024-12-24T16:48:46Z")

</div>

Hello, Please take a look at the following text: Consider the following: julia\> grk = “β+θ” “β+θ” julia\> length(grk) 3 julia\> sizeof(grk) 5 Since β and θ occupy two bytes each, the valid indices into grk are 1 …

---

## [A question about SubString](https://discourse.julialang.org/t/a-question-about-substring/123838)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 8\
**Last updated:** [December 15, 2024, 8:21am UTC](https://discourse.julialang.org/t/a-question-about-substring/123838 "2024-12-15T08:21:55Z")

</div>

Hello, What is the difference between SubString and Indexing? I did: julia\> str = "Where the mind is without fear" "Where the mind is without fear" julia\> SubString(str, 1, 5) "Where" julia\> str\[1:5\] "Where" The res…

---

## [Print string on specific character position](https://discourse.julialang.org/t/print-string-on-specific-character-position/121402)

<div class="topic-metadata">

**Author:** [@danrib07](https://discourse.julialang.org/u/danrib07)\
**Replies:** 4\
**Last updated:** [October 17, 2024, 1:13pm UTC](https://discourse.julialang.org/t/print-string-on-specific-character-position/121402 "2024-10-17T13:13:17Z")

</div>

Hi everyone, I’m trying to format some diagnostics for a Julia project I’m working on, and I was wondering if there’s a way to format strings such that the output is printed on a specific character position? For example,…

---

## [Is there a built in macro like @show that returns a string?](https://discourse.julialang.org/t/is-there-a-built-in-macro-like-show-that-returns-a-string/88234)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 9\
**Last updated:** [October 13, 2024, 11:41pm UTC](https://discourse.julialang.org/t/is-there-a-built-in-macro-like-show-that-returns-a-string/88234 "2024-10-13T23:41:40Z")

</div>

I want the macro @show but to return a string instead of printing. Does something like that already exist?

---

## [How can I create a fancier REPL prompt with styled strings? (was: Make \`Base.textwidth\` ignore ANSI sequences)](https://discourse.julialang.org/t/how-can-i-create-a-fancier-repl-prompt-with-styled-strings-was-make-base-textwidth-ignore-ansi-sequences/120782)

<div class="topic-metadata">

**Author:** [@HanD](https://discourse.julialang.org/u/HanD)\
**Replies:** 12\
**Last updated:** [October 8, 2024, 11:18am UTC](https://discourse.julialang.org/t/how-can-i-create-a-fancier-repl-prompt-with-styled-strings-was-make-base-textwidth-ignore-ansi-sequences/120782 "2024-10-08T11:18:51Z")

</div>

I’m trying to spice up my Julia REPL prompt with ANSI color codes (not just one single color, but multiple colors in the same line). However, it messes up the cursor alignment, because the code in REPL.jl also counts the…

---

## [Why are Julia strings immutable?](https://discourse.julialang.org/t/why-are-julia-strings-immutable/117320)

<div class="topic-metadata">

**Author:** [@jpnesseth](https://discourse.julialang.org/u/jpnesseth)\
**Replies:** 13\
**Last updated:** [September 28, 2024, 4:33pm UTC](https://discourse.julialang.org/t/why-are-julia-strings-immutable/117320 "2024-09-28T16:33:52Z")

</div>

The question I have (after coming here, apparently VERY late), is WHY are strings immutable? Meaning, I’m assuming this either means that Julia doesn’t implement strings as arrays of characters, or there is a reason oth…

---

## [String optimisation in Julia](https://discourse.julialang.org/t/string-optimisation-in-julia/119301)

<div class="topic-metadata">

**Author:** [@sivakon](https://discourse.julialang.org/u/sivakon)\
**Replies:** 21\
**Last updated:** [September 21, 2024, 2:42pm UTC](https://discourse.julialang.org/t/string-optimisation-in-julia/119301 "2024-09-21T14:42:29Z")

</div>

Came across this benchmark that tries to create large string and save to file. The difference between Julia and Java is very high. (I’m assuming Java version the string is being saved and reused without allocating?). …

---

## [How to create a Cstring from a String?](https://discourse.julialang.org/t/how-to-create-a-cstring-from-a-string/98566)

<div class="topic-metadata">

**Author:** [@heyx3](https://discourse.julialang.org/u/heyx3)\
**Replies:** 4\
**Last updated:** [May 9, 2023, 6:57pm UTC](https://discourse.julialang.org/t/how-to-create-a-cstring-from-a-string/98566 "2023-05-09T18:57:59Z")

</div>

I’m trying to implement callback functions for a C library, to get and set the clipboard text. My functions look like this: clipboard\_get(::Ptr{Cvoid})::Cstring = string(clipboard()) const CLIPBOARD\_FN\_GET = @cfunction(…

---

## [Fastest way to read fixed-width tables embedded in a larger text file](https://discourse.julialang.org/t/fastest-way-to-read-fixed-width-tables-embedded-in-a-larger-text-file/118108)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 9\
**Last updated:** [August 14, 2024, 11:11pm UTC](https://discourse.julialang.org/t/fastest-way-to-read-fixed-width-tables-embedded-in-a-larger-text-file/118108 "2024-08-14T23:11:36Z")

</div>

I’ve got a bunch of .txt files that contain a few hundred lines of “junk” at the beginning, then two tables embedded at the end. Those two tables always begin the same number of lines from the end of the file. Further, t…

---

## [Optimize splitting vector of strings](https://discourse.julialang.org/t/optimize-splitting-vector-of-strings/117924)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 10\
**Last updated:** [August 8, 2024, 1:27pm UTC](https://discourse.julialang.org/t/optimize-splitting-vector-of-strings/117924 "2024-08-08T13:27:50Z")

</div>

I am learning how to optimize julia code and came up with the following MWE: using BenchmarkTools, Profile strvec = \["AA entryA", "BBC entryB", "CCM entryC"\] function split\_vec(strvec) mat = stack(split.(strvec),…

---

## [Make ProgressMeter description display depends on a for-loop variable](https://discourse.julialang.org/t/make-progressmeter-description-display-depends-on-a-for-loop-variable/117509)

<div class="topic-metadata">

**Author:** [@K5Julien](https://discourse.julialang.org/u/K5Julien)\
**Replies:** 3\
**Last updated:** [July 27, 2024, 12:49pm UTC](https://discourse.julialang.org/t/make-progressmeter-description-display-depends-on-a-for-loop-variable/117509 "2024-07-27T12:49:53Z")

</div>

The following works well: using ProgressMeter @showprogress dt=1 desc="Computing ..." for c in 1:100\_000 # Some computing end However, I’d like the description to display some string that depends on c: using Progr…

---

## [Split keepempty](https://discourse.julialang.org/t/split-keepempty/117453)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 1\
**Last updated:** [July 25, 2024, 4:57am UTC](https://discourse.julialang.org/t/split-keepempty/117453 "2024-07-25T04:57:27Z")

</div>

What does keepempty mean in split? Is there a good example? • keepempty: whether empty fields should be kept in the result. Default is false without a dlm argument, true with a dlm argument. julia\> split("hello;ther…

[Next page](https://discourse.julialang.org/tag/strings/73.md?match_all_tags=true&page=1&tags%5B%5D=strings)
