0

Is there something that can do this in Ruby?

a = 'astring'[0..[5,'astring'.length].min]

Can anything take that string and generate a integer from it? In Python I could use:

int(a,36) 

The output would be "18141102".

4

1 に答える 1

2

ダンが言ったように、あなたは を探していto_iます。

a.to_i(36)
于 2013-09-19T01:01:19.633 に答える