# Text to data-structure declaritively

**URL:** <https://discourse.julialang.org/t/text-to-data-structure-declaritively/59066>\
**Category:** General Usage\
**Tags:** strings, tuple\
**Created:** [April 12, 2021, 2:16am UTC](https://discourse.julialang.org/t/text-to-data-structure-declaritively/59066 "2021-04-12T02:16:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lincoln\_Hannah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lincoln_hannah/32/19198_2.png) [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Post date:** [April 12, 2021, 2:16am UTC](https://discourse.julialang.org/t/text-to-data-structure-declaritively/59066/1 "2021-04-12T02:16:10Z")

</div>

To convert:

X = `"John.Smith,20"`

to a named tuple

`Tup = (First_Name = "John", Last_Name = "Smith", Age = 20 )`

I usually do something like:

`Tup = (First_Name, Last_Name, Age) = @pipe split("John.Smith,20", '.' ) |> ( _[1] , split(_[2], ',' )... )`

But is it possible to do it more declaratively?  
For example, use Julia’s $ variable within string syntax in reverse ?

`"$(First_Name).$(Last_Name),$(Age)" = X`

I know regex does this sort of thing though I find it very hard to read.
