# Split dot and equa sign by recursive

**URL:** <https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509>\
**Category:** ruby-talk\
**Created:** [22 April 2011 10:52 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509 "2011-04-22T10:52:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sira\_PS](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sira\_PS](https://rubytalk.org/u/Sira_PS)\
**Post date:** [22 April 2011 10:52 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509/1 "2011-04-22T10:52:09Z")

</div>

I need to do a function which can split dot and equa by recursive.  
But I don't have any ideas to do on recursive.

This is the example of my strings

Member.certPm=PM Certification  
projects.risks.Index.flash\_downloading=Downloading report, please wait..

The numbers of dot it is different. I need to split these strings and  
set on hashes

Member =\> {certPm =\> PM Certification}  
projects =\> {risks =\> {Index =\> {flash\_downloading =\> Downloading  
report, please wait..}}}

Do you have any guide for me to do this?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Harry3](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@Harry3](https://rubytalk.org/u/Harry3)\
**Post date:** [23 April 2011 12:04 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509/2 "2011-04-23T12:04:05Z")

</div>

Do I understand this correctly?

You have a string like this,

"projects.risks.Index.flash\_downloading=Downloading report, please wait.."

and you want to produce this,

projects =\> {risks =\> {Index =\> {flash\_downloading =\> Downloading  
report, please wait..}}}

Is that what you want to do?

Harry

> **···**
>
> On Fri, Apr 22, 2011 at 7:52 PM, Siratinee Sukachai \<ploy.sukachai@gmail.com\> wrote:
> 
> > I need to do a function which can split dot and equa by recursive.  
> > But I don't have any ideas to do on recursive.
> > 
> > This is the example of my strings
> > 
> > Member.certPm=PM Certification  
> > projects.risks.Index.flash\_downloading=Downloading report, please wait..
> > 
> > The numbers of dot it is different. I need to split these strings and  
> > set on hashes
> > 
> > Member =\> {certPm =\> PM Certification}  
> > projects =\> {risks =\> {Index =\> {flash\_downloading =\> Downloading  
> > report, please wait..}}}
> > 
> > Do you have any guide for me to do this?
> > 
> > --

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://rubytalk.org/u/Brian_Candler)\
**Post date:** [23 April 2011 12:14 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509/3 "2011-04-23T12:14:25Z")

</div>

Siratinee Sukachai wrote in post #994481:

> I need to do a function which can split dot and equa by recursive.  
> But I don't have any ideas to do on recursive.

Is this a homework question? Otherwise, why do you say you want to use a  
recursive algorithm, but then say you don't know anything about  
recursion?

A structure like :a =\> {:b =\> {:c =\> :d} } is nested. You do not need to  
use recursion to build it.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Sira\_PS](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sira\_PS](https://rubytalk.org/u/Sira_PS)\
**Post date:** [24 April 2011 04:28 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509/4 "2011-04-24T04:28:20Z")

</div>

I already found the solution.

thx

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [23 April 2011 15:37 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509/5 "2011-04-23T15:37:22Z")

</div>

Almost guaranteed. Google the email address.

> **···**
>
> On Apr 23, 2011, at 5:14, Brian Candler \<b.candler@pobox.com\> wrote:
> 
> > Is this a homework question? Otherwise, why do you say you want to use a  
> > recursive algorithm, but then say you don't know anything about  
> > recursion?

---

<div class="post-metadata">

**Author:** ![Sira\_PS](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sira\_PS](https://rubytalk.org/u/Sira_PS)\
**Post date:** [23 April 2011 17:36 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509/6 "2011-04-23T17:36:56Z")

</div>

> Do I understand this correctly?
> 
> You have a string like this,
> 
> "projects.risks.Index.flash\_downloading=Downloading report, please  
> wait.."
> 
> and you want to produce this,
> 
> projects =\> {risks =\> {Index =\> {flash\_downloading =\> Downloading  
> report, please wait..}}}

> Is that what you want to do?

> Harry

Yes, that's what I want.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Harry3](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@Harry3](https://rubytalk.org/u/Harry3)\
**Post date:** [24 April 2011 03:19 UTC](https://rubytalk.org/t/split-dot-and-equa-sign-by-recursive/62509/7 "2011-04-24T03:19:56Z")

</div>

> Yes, that's what I want.

What have you tried so far?

Harry
