# Is Julia well-suited for string manipulation?

**URL:** <https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943>\
**Category:** General Usage\
**Tags:** strings\
**Created:** [January 13, 2023, 4:43pm UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943 "2023-01-13T16:43:02Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [January 19, 2023, 11:08am UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943/21 "2023-01-19T11:08:18Z")

</div>

> [@jakobnissen](#):
>
> It wouldn’t even need to be generic, i.e. implemented with `@foo_char` macro.

I don’t understand this sentence. Does this mean it needs or does not need to be implemented with `@foo_char` macro? I didn’t know there were such char macros, or is your point that there aren’t?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 19, 2023, 2:16pm UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943/22 "2023-01-19T14:16:45Z")

</div>

> [@jakobnissen](#):
>
> Rust has `b'A'`, we could have that as well.

Would be breaking, since `b'A'` is currently parsed as `b' * A'`

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [January 19, 2023, 3:06pm UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943/23 "2023-01-19T15:06:32Z")

</div>

> [@stevengj](#):
>
> Would be breaking, since `b'A'` is currently parsed as `b' * A'`

Too bad. I never liked that Mathematica-ism anyway. But that ship is long gone.

---

<div class="post-metadata">

**Author:** ![uniment](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uniment/32/24532_2.png) [@uniment](https://discourse.julialang.org/u/uniment)\
**Post date:** [January 20, 2023, 1:38am UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943/24 "2023-01-20T01:38:29Z")

</div>

This is one of my favorite things though:

```julia
julia> using ForwardDiff

julia> Base.adjoint(f::Function) = Base.Fix1(ForwardDiff.derivative, f)

julia> f(x) = x^2
f (generic function with 1 method)

julia> f'(1)
2

julia> f''(1)
2

julia> f'''(1)
0

```

type piracy schmiracy, Newton notation precedes Julia’s type system anyway

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [March 24, 2023, 4:26am UTC](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943/25 "2023-03-24T04:26:51Z")

</div>

You could also try using `Strs.jl`, and the ASCIIStr/ASCIIChr types.  
It is faster than any of your methods above, even the ones using codeunits().

[Previous page](https://discourse.julialang.org/t/is-julia-well-suited-for-string-manipulation/92943.md?page=1)
