# Split dot and equa sign by recursive

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

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

Member => {certPm => PM Certification}

Do you have any guide for me to do this?

# sample code:

def foo(str)
memo = {}
key,value = str.split(/[.=]/,2)
return str if value == nil
memo[key] = foo(value)
return memo
end

On Fri, Apr 22, 2011 at 7:52 PM, Siratinee S.
[email protected] wrote:

Member => {certPm => PM Certification}

Do you have any guide for me to do this?

Do I understand this correctly?

You have a string like this,

wait…”

and you want to produce this,

Is that what you want to do?

Harry

On Apr 23, 2011, at 5:14, Brian C. [email protected] 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?

Siratinee S. 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.

Yes, that’s what I want.

What have you tried so far?

Harry

thx

Do I understand this correctly?

You have a string like this,