# Left and right division for strings

**URL:** <https://discourse.julialang.org/t/left-and-right-division-for-strings/109839>\
**Category:** Internals & Design\
**Tags:** strings, arithmetic\
**Created:** [February 6, 2024, 9:31pm UTC](https://discourse.julialang.org/t/left-and-right-division-for-strings/109839 "2024-02-06T21:31:04Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [February 6, 2024, 9:45pm UTC](https://discourse.julialang.org/t/left-and-right-division-for-strings/109839/7 "2024-02-06T21:45:56Z")

</div>

I don’t work with strings much, but I have found myself in a few situations before where I’ve done things like

```julia
if endswith(path, ".jl")
    path[begin:end-3]
end

```

could instead be

```julia
if endswith(path, ".jl")
    path / ".jl"
end

```

That’s a really simple example, but I’ve found a few times when writing string macros, that there’s often prefixes or suffixes I know are there that I want to chop off.

---

_[View the full topic](https://discourse.julialang.org/t/left-and-right-division-for-strings/109839)._
