# Lower cased and dashed strings

**URL:** <https://discuss.kakoune.com/t/lower-cased-and-dashed-strings/183>\
**Category:** Archives\
**Created:** [November 19, 2018, 6:09pm UTC](https://discuss.kakoune.com/t/lower-cased-and-dashed-strings/183 "2018-11-19T18:09:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eraserhd](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/eraserhd/32/15_2.png) [@eraserhd](https://discuss.kakoune.com/u/eraserhd)\
**Post date:** [November 19, 2018, 6:09pm UTC](https://discuss.kakoune.com/t/lower-cased-and-dashed-strings/183/1 "2018-11-19T18:09:19Z")

</div>

[http://www.vimgolf.com/challenges/55f9720b4a665c2acf0008c8](http://www.vimgolf.com/challenges/55f9720b4a665c2acf0008c8)

**Lower cased and dashed strings**

As I have to generate big fixtures files, I wanted to find a way to format input data the way described by start and end files.

Especially the lower-cased-and-dashed ids  
Not so good to find a pure Vim way, that's why I submit this challenge 😉  
Start file:

```auto
Lôrem Ipsum
Dolor.eros
Auctor: eros (elémentum)
Tincïdunt, âc

```

End file:

```auto
lorem-ipsum:
    name: "Lôrem Ipsum"
dolor-eros:
    name: "Dolor.eros"
auctor-eros-elementum:
    name: "Auctor: eros (elémentum)"
tincidunt-ac:
    name: "Tincïdunt, âc"

```

This one is already in the golf repo, but it’s from 2016 and 60 keystrokes vs Vim’s 60, and I think we could do better.

---

<div class="post-metadata">

**Author:** ![eraserhd](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/eraserhd/32/15_2.png) [@eraserhd](https://discuss.kakoune.com/u/eraserhd)\
**Post date:** [November 19, 2018, 6:41pm UTC](https://discuss.kakoune.com/t/lower-cased-and-dashed-strings/183/2 "2018-11-19T18:41:22Z")

</div>

57 (using `tr`\*):

```auto
%S\n<ret>y`|tr -s 'âéïô .(:,' aeio-<ret>A:<ret>name: "<c-r>""<esc><gt>%s\):<ret>hd,q

```

- Yeah, I know in Vimgolf you aren’t allowed to use external programs, but external programs are kind of Kakoune’s philosophy.

---

<div class="post-metadata">

**Author:** ![GrantMoyer](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/g/a587f6/32.png) [@GrantMoyer](https://discuss.kakoune.com/u/GrantMoyer)\
**Post date:** [November 20, 2018, 5:11am UTC](https://discuss.kakoune.com/t/lower-cased-and-dashed-strings/183/3 "2018-11-20T05:11:06Z")

</div>

56 without external programs:

```
%<a-s>yp`Hs\W+<ret>c-<esc>xs-?\n<ret>c:<ret>name: "<esc>A"<esc><gt>/[oeia]<ret>yxs[â-ô]<ret>R2<a-)>
```
