# \#strings

**URL:** https://discourse.julialang.org/tag/strings/73.md?match_all_tags=true&page=5&tags%5B%5D=strings

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

**Page:** 6

---

## [Issue with findfirst on a string](https://discourse.julialang.org/t/issue-with-findfirst-on-a-string/71903)

<div class="topic-metadata">

**Author:** [@rgriset](https://discourse.julialang.org/u/rgriset)\
**Replies:** 3\
**Last updated:** [November 25, 2021, 1:27pm UTC](https://discourse.julialang.org/t/issue-with-findfirst-on-a-string/71903 "2021-11-25T13:27:17Z")

</div>

Hi, I’m trying to parse a parameter file with julia. I have lines of commentary that I would like not to process . I tried : lines = readlines(file) for line in lines line=split(line,"\\t") if sizeof(line)\>0 nom…

---

## [Line feed by spaces](https://discourse.julialang.org/t/line-feed-by-spaces/71439)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 11\
**Last updated:** [November 14, 2021, 3:44pm UTC](https://discourse.julialang.org/t/line-feed-by-spaces/71439 "2021-11-14T15:44:58Z")

</div>

hello, can you tell me how to make a better function that performs line feeds by spaces, than what I did with my natural science education, i, j, l and += 1 ? function feed\_lines(str::String, l::Int) chars = collect…

---

## [Write - accented characters take extra byte](https://discourse.julialang.org/t/write-accented-characters-take-extra-byte/71271)

<div class="topic-metadata">

**Author:** [@yoh-meyers](https://discourse.julialang.org/u/yoh-meyers)\
**Replies:** 6\
**Last updated:** [November 11, 2021, 10:31pm UTC](https://discourse.julialang.org/t/write-accented-characters-take-extra-byte/71271 "2021-11-11T22:31:47Z")

</div>

Hello, When calling write with a string containing accented characters, I realise that 2 bytes are returned. E.g: julia\> write(stdout, "ñ") ñ2 julia\> write(stdout, "n") n1 This is an issue when the output is expecti…

---

## [Interpolation to any string](https://discourse.julialang.org/t/interpolation-to-any-string/71020)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 6\
**Last updated:** [November 6, 2021, 7:05pm UTC](https://discourse.julialang.org/t/interpolation-to-any-string/71020 "2021-11-06T19:05:11Z")

</div>

Hi, is it possible to create a universal function to interpolation to any string? maybe there is a function to pass values to the template one at time? teplate = "\\$str1 \\$str2" function get\_text\_by\_template(teplate; …

---

## [Broadcast SubString to subset of DataFrame rows?](https://discourse.julialang.org/t/broadcast-substring-to-subset-of-dataframe-rows/70817)

<div class="topic-metadata">

**Author:** [@blackeneth](https://discourse.julialang.org/u/blackeneth)\
**Replies:** 6\
**Last updated:** [November 2, 2021, 8:46pm UTC](https://discourse.julialang.org/t/broadcast-substring-to-subset-of-dataframe-rows/70817 "2021-11-02T20:46:03Z")

</div>

Hi, Say I have a large DataFrame, with thousands of rows. For some of those rows, I need to parse out a substring and put it in another column. In my case, these rows have “Register(nnnn)” in them, and I need to extrac…

---

## [Regex matching when string has non-ascii unicode](https://discourse.julialang.org/t/regex-matching-when-string-has-non-ascii-unicode/70311)

<div class="topic-metadata">

**Author:** [@sleak](https://discourse.julialang.org/u/sleak)\
**Replies:** 3\
**Last updated:** [October 26, 2021, 1:04pm UTC](https://discourse.julialang.org/t/regex-matching-when-string-has-non-ascii-unicode/70311 "2021-10-26T13:04:42Z")

</div>

I’m using regex to split a string and getting unexpected results when the input data contains non-ascii characters (specifically, a unicode \\xe8). In python I can do: \>\>\> import re \>\>\> s = "caf\\xe8" \>\>\> re.findall('.', …

---

## [Bug in replace! function](https://discourse.julialang.org/t/bug-in-replace-function/70388)

<div class="topic-metadata">

**Author:** [@Cevheriferd](https://discourse.julialang.org/u/Cevheriferd)\
**Replies:** 3\
**Last updated:** [October 26, 2021, 9:30am UTC](https://discourse.julialang.org/t/bug-in-replace-function/70388 "2021-10-26T09:30:25Z")

</div>

See the following MWE: a = "Hello World" #"Hello World" b = replace(a,"Hello" =\> "Bye") #"Bye World" replace!(a, "Hello" =\> "Bye") #ERROR: LoadError: MethodError: no method matching \_replace!(::Base.var"#new#295"{Tupl…

---

## [StringDocument() of the TextAnalysis package](https://discourse.julialang.org/t/stringdocument-of-the-textanalysis-package/62589)

<div class="topic-metadata">

**Author:** [@Alex\_Tantos](https://discourse.julialang.org/u/Alex_Tantos)\
**Replies:** 3\
**Last updated:** [October 24, 2021, 5:52pm UTC](https://discourse.julialang.org/t/stringdocument-of-the-textanalysis-package/62589 "2021-10-24T17:52:50Z")

</div>

Hi there! Has anybody been using the StringDocument() function of the TextAnalysis package for unicode encoded language strings? However, if I use StringDocument() with a readin (greek) string from a file with the read…

---

## [Reading a vector string file](https://discourse.julialang.org/t/reading-a-vector-string-file/70247)

<div class="topic-metadata">

**Author:** [@Peter-Jolly](https://discourse.julialang.org/u/Peter-Jolly)\
**Replies:** 4\
**Last updated:** [October 23, 2021, 4:26am UTC](https://discourse.julialang.org/t/reading-a-vector-string-file/70247 "2021-10-23T04:26:27Z")

</div>

Hi I am trying to do a very simple operation dealing with strings (normally I work with numerical data so not too familiar with strings). I want to read in a list of names from a file called Name\_List.txt (each name on o…

---

## [Understanding \`sizeof\` return values on \`Char\` / \`String\`](https://discourse.julialang.org/t/understanding-sizeof-return-values-on-char-string/70099)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 2\
**Last updated:** [October 20, 2021, 2:56pm UTC](https://discourse.julialang.org/t/understanding-sizeof-return-values-on-char-string/70099 "2021-10-20T14:56:09Z")

</div>

Can someone explain this behavior of sizeof vs summarysize ? sizeof("z") # 1 sizeof('z') # 4 Base.summarysize('z') # 4 Base.summarysize("z") # 9 When I read the doc sizeof(str::AbstractString) Size, in bytes, of the…

---

## [Replace two substrings in a string with the same \`replace\` call?](https://discourse.julialang.org/t/replace-two-substrings-in-a-string-with-the-same-replace-call/70053)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 2\
**Last updated:** [October 20, 2021, 7:47am UTC](https://discourse.julialang.org/t/replace-two-substrings-in-a-string-with-the-same-replace-call/70053 "2021-10-20T07:47:00Z")

</div>

I just found that replace could be used to replace two bits of a vector as in replace(\[1, 2, 1, 3\], 1=\>0, 2=\>4) Where the replacements are defined using Pair. I tried that with a string instead of an integer vector, b…

---

## [Broadcasting on Vector{SubString{String}} does not work in Julia 1.7.0 rc1?](https://discourse.julialang.org/t/broadcasting-on-vector-substring-string-does-not-work-in-julia-1-7-0-rc1/69913)

<div class="topic-metadata">

**Author:** [@pszufe](https://discourse.julialang.org/u/pszufe)\
**Replies:** 12\
**Last updated:** [October 16, 2021, 10:27pm UTC](https://discourse.julialang.org/t/broadcasting-on-vector-substring-string-does-not-work-in-julia-1-7-0-rc1/69913 "2021-10-16T22:27:15Z")

</div>

I use Julia 1.7.0rc1 and it seems that broadcasting works for Vector{String} and does not work on Vector{SubString{String}}. Is this something intended or I run into a bug? For Vector{String} all works as expected: jul…

---

## [Load and reformatting CSV file](https://discourse.julialang.org/t/load-and-reformatting-csv-file/69518)

<div class="topic-metadata">

**Author:** [@rami](https://discourse.julialang.org/u/rami)\
**Replies:** 6\
**Last updated:** [October 10, 2021, 11:10pm UTC](https://discourse.julialang.org/t/load-and-reformatting-csv-file/69518 "2021-10-10T23:10:12Z")

</div>

Hello, I am trying to load a CSV file from a Github rep, reformat, and store it as DataFrame obj. Here is what I tried: using CSV, HTTP, DataFrames url = "https://raw.githubusercontent.com/RamiKrispin/coronavirus/maste…

---

## [Why is AbstractString not a subtype of AbstractVector?](https://discourse.julialang.org/t/why-is-abstractstring-not-a-subtype-of-abstractvector/69189)

<div class="topic-metadata">

**Author:** [@jonas-schulze](https://discourse.julialang.org/u/jonas-schulze)\
**Replies:** 10\
**Last updated:** [October 7, 2021, 1:28pm UTC](https://discourse.julialang.org/t/why-is-abstractstring-not-a-subtype-of-abstractvector/69189 "2021-10-07T13:28:28Z")

</div>

While working on https://github.com/JuliaCollections/DataStructures.jl/pull/759, which I thought would be a funny solution to a project euler riddle, I noticed that String is not a subtype of AbstractVector{Char}. Are th…

---

## [Is there a direct way in Julia to format a number e.g. 9999999999 as a String object "9,999,999,999" for making it convenient to read?](https://discourse.julialang.org/t/is-there-a-direct-way-in-julia-to-format-a-number-e-g-9999999999-as-a-string-object-9-999-999-999-for-making-it-convenient-to-read/68861)

<div class="topic-metadata">

**Author:** [@shubh\_b](https://discourse.julialang.org/u/shubh_b)\
**Replies:** 3\
**Last updated:** [September 28, 2021, 10:16am UTC](https://discourse.julialang.org/t/is-there-a-direct-way-in-julia-to-format-a-number-e-g-9999999999-as-a-string-object-9-999-999-999-for-making-it-convenient-to-read/68861 "2021-09-28T10:16:45Z")

</div>

Is there any Julia function or a straightforward way that can format a large integer number as a String object in which every 3 digits can become delimited by comma (,) from the end? This thing we can do in Python using…

---

## [A couple of questions about arrays and "findall" function](https://discourse.julialang.org/t/a-couple-of-questions-about-arrays-and-findall-function/68785)

<div class="topic-metadata">

**Author:** [@Jesus-117](https://discourse.julialang.org/u/Jesus-117)\
**Replies:** 3\
**Last updated:** [September 26, 2021, 7:23pm UTC](https://discourse.julialang.org/t/a-couple-of-questions-about-arrays-and-findall-function/68785 "2021-09-26T19:23:40Z")

</div>

Hello there !! I am new to programming in general and I have a couple of questions about how to use strings, if I have an example text and I would like to count the spaces in the text like this: ExampleText= "a b c d e …

---

## [A Question about Vectors with strings](https://discourse.julialang.org/t/a-question-about-vectors-with-strings/68661)

<div class="topic-metadata">

**Author:** [@Jesus-117](https://discourse.julialang.org/u/Jesus-117)\
**Replies:** 5\
**Last updated:** [September 24, 2021, 1:34pm UTC](https://discourse.julialang.org/t/a-question-about-vectors-with-strings/68661 "2021-09-24T13:34:43Z")

</div>

I’m new to julia, out of curiosity, I thought about recreating a problem that I did in Matlab at the time: With compact notation write a vector that has as odd entries the numbers from 1 to 100 in string form and the odd…

---

## [Is there a way to keep the delimiter in split function, as a separate element?](https://discourse.julialang.org/t/is-there-a-way-to-keep-the-delimiter-in-split-function-as-a-separate-element/51995)

<div class="topic-metadata">

**Author:** [@D\_A](https://discourse.julialang.org/u/D_A)\
**Replies:** 2\
**Last updated:** [December 17, 2020, 8:15pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-keep-the-delimiter-in-split-function-as-a-separate-element/51995 "2020-12-17T20:15:41Z")

</div>

Hello, This is identical to this. In my case, if I want to split a string (for example a quite complex anthroponym, with dashes, apostrophes, etc.), making complex capitalization depending on these punctuation delimite…

---

## [String labels in the x axis](https://discourse.julialang.org/t/string-labels-in-the-x-axis/67880)

<div class="topic-metadata">

**Author:** [@Joao\_Barata](https://discourse.julialang.org/u/Joao_Barata)\
**Replies:** 1\
**Last updated:** [September 8, 2021, 3:52pm UTC](https://discourse.julialang.org/t/string-labels-in-the-x-axis/67880 "2021-09-08T15:52:03Z")

</div>

Hi, I’m trying to make a plot with a numerical series on the y axis and a string series on the x axis. The x series is a vector like this, imported which is extracted from a data frame: 88-element Vector{Any}: "1997 Q…

---

## [How to avoid evaluation into the global space when the expression is not know in advance](https://discourse.julialang.org/t/how-to-avoid-evaluation-into-the-global-space-when-the-expression-is-not-know-in-advance/67342)

<div class="topic-metadata">

**Author:** [@JianghuiDu](https://discourse.julialang.org/u/JianghuiDu)\
**Replies:** 31\
**Last updated:** [August 30, 2021, 3:05pm UTC](https://discourse.julialang.org/t/how-to-avoid-evaluation-into-the-global-space-when-the-expression-is-not-know-in-advance/67342 "2021-08-30T15:05:00Z")

</div>

input = Dict("x"=\>ones(10),"y"=\>2\*ones(10),"z"=\>3\*ones(10)) expr\_list = DataFrame(var=\["v1","v2","v3"\],expr = \["x\*y","y/z","x+y+z"\]) output = Dict() I have a dictionary of input storing the values of some variables x,…

---

## [Transpose of an array of Strings](https://discourse.julialang.org/t/transpose-of-an-array-of-strings/40431)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 31\
**Last updated:** [August 28, 2021, 12:08pm UTC](https://discourse.julialang.org/t/transpose-of-an-array-of-strings/40431 "2021-08-28T12:08:48Z")

</div>

Consider the statement: a = \[1 2 3 4 \] and its transpose a', which generates a column vector. Now do the same with strings: b = \["a" "b" "c"\] and transpose it. I get the following error (which is very hard to believ…

---

## [MethodError: no method matching getindex(::Nothing, ::String)](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-nothing-string/67080)

<div class="topic-metadata">

**Author:** [@Sebastian\_Mena](https://discourse.julialang.org/u/Sebastian_Mena)\
**Replies:** 3\
**Last updated:** [August 28, 2021, 12:33am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-nothing-string/67080 "2021-08-28T00:33:10Z")

</div>

Hi, I’m trying to do an iteration, where I use a dictionary that gives me an array with values (“players”) and an array with weights (“weights”) with the same size, to make a sample. When I do it outside of iteration it …

---

## [IO write/read \<strlen\> \<string\>](https://discourse.julialang.org/t/io-write-read-strlen-string/66362)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 15\
**Last updated:** [August 17, 2021, 8:24pm UTC](https://discourse.julialang.org/t/io-write-read-strlen-string/66362 "2021-08-17T20:24:27Z")

</div>

With the suggestions below: # write number as type T function writenum(io, num, T) write(io, T(num)) end # read n numbers of type T function readnum(io, T, n) s = sizeof(T) f = zeros(UInt8, s\*n) readbyte…

---

## [Sorting strings containing numbers, so that "A2" \< "A10"?](https://discourse.julialang.org/t/sorting-strings-containing-numbers-so-that-a2-a10/5372)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 28\
**Last updated:** [August 16, 2021, 7:50pm UTC](https://discourse.julialang.org/t/sorting-strings-containing-numbers-so-that-a2-a10/5372 "2021-08-16T19:50:08Z")

</div>

I need to sort strings containing numbers. Is there a simple way to sort them, such that, for example, "A2" \< "A10"? That is, I want a lexicographic compare, such that numbers in the string are compared by value. I gues…

---

## [Raw string "$"](https://discourse.julialang.org/t/raw-string/64948)

<div class="topic-metadata">

**Author:** [@Angie\_Cruz](https://discourse.julialang.org/u/Angie_Cruz)\
**Replies:** 5\
**Last updated:** [July 19, 2021, 10:05pm UTC](https://discourse.julialang.org/t/raw-string/64948 "2021-07-19T22:05:58Z")

</div>

Hello, I would like to print “abc$def” as a string x = "abc$def" but it doesn’t allow me because of the $, I tried to write it like this x="abc"\*raw"$"\*"def" but I get the following: "abc\\$def" My issue is that I d…

---

## [Julia subsumes ICON: well done](https://discourse.julialang.org/t/julia-subsumes-icon-well-done/63517)

<div class="topic-metadata">

**Author:** [@blackeneth](https://discourse.julialang.org/u/blackeneth)\
**Replies:** 3\
**Last updated:** [June 25, 2021, 7:30pm UTC](https://discourse.julialang.org/t/julia-subsumes-icon-well-done/63517 "2021-06-25T19:30:36Z")

</div>

I developed a likely poor-supported belief the developers where re-evaluating Julia’s string functionality for Julia 2.0 from some off-hand comment that @StefanKarpinski made in some post. That’s an interest area of min…

---

## [\[ANN\] HypertextLiteral.jl - generate tagged content with interpolation](https://discourse.julialang.org/t/ann-hypertextliteral-jl-generate-tagged-content-with-interpolation/51933)

<div class="topic-metadata">

**Author:** [@cce](https://discourse.julialang.org/u/cce)\
**Replies:** 4\
**Last updated:** [June 20, 2021, 8:23pm UTC](https://discourse.julialang.org/t/ann-hypertextliteral-jl-generate-tagged-content-with-interpolation/51933 "2021-06-20T20:23:36Z")

</div>

With the assistance of many in the Pluto.jl community, I’ve created a performant implementation of @mbostock’s hypertext literal for server-side Julia applications. This package lets you use familiar string interpolat…

---

## [Convert an Array Written as a String to An Actual Array](https://discourse.julialang.org/t/convert-an-array-written-as-a-string-to-an-actual-array/62013)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 7\
**Last updated:** [May 30, 2021, 8:33am UTC](https://discourse.julialang.org/t/convert-an-array-written-as-a-string-to-an-actual-array/62013 "2021-05-30T08:33:06Z")

</div>

Hi all, I have no idea how this happened, but I am using a dataset where in the file, arrays were actually stored as strings like this: "\[1, 2, 3, 4, 5\]" How do I best convert the above into an actual array of integer…

---

## [Parse structured string to dictionary](https://discourse.julialang.org/t/parse-structured-string-to-dictionary/8126)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 6\
**Last updated:** [May 22, 2021, 7:41pm UTC](https://discourse.julialang.org/t/parse-structured-string-to-dictionary/8126 "2021-05-22T19:41:53Z")

</div>

Let’s say I have a string which has the following template structure: "a\_{a}\_b\_{b}\_c\_{c}.{txt}.{ext}" Example: “a\_3\_b\_4\_c\_5.whatever.jld” My question is how to conveniently generate such string from given (string) va…

---

## [Dot calls / broadcasts for strings](https://discourse.julialang.org/t/dot-calls-broadcasts-for-strings/61195)

<div class="topic-metadata">

**Author:** [@fedario](https://discourse.julialang.org/u/fedario)\
**Replies:** 19\
**Last updated:** [May 20, 2021, 2:44am UTC](https://discourse.julialang.org/t/dot-calls-broadcasts-for-strings/61195 "2021-05-20T02:44:37Z")

</div>

I encountered some unexpected behavior regarding broadcasted functions for strings. Let’s say we have two strings: a = "abc" b = "abx" When checking for equality, the result was as I expected: a == b # result: false …

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

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