Is there any possible to convert a string to a symbol, such as "foo"->:foo?
'foo'.to_sym
···
On Oct 11, 2014 7:27 AM, "xiaopeng" <1093218247@qq.com> wrote:
Is there any possible to convert a string to a symbol, such as
"foo"->:foo?
Hint: the documentation is your friend:
···
On Sat, Oct 11, 2014 at 7:26 AM, xiaopeng <1093218247@qq.com> wrote:
Is there any possible to convert a string to a symbol, such as "foo"->:foo?
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Yep!
"mystring".to_sym
-> :mystring
···
On 10/11/2014 10:26 AM, xiaopeng wrote:
Is there any possible to convert a string to a symbol, such as "foo"->:foo?
Quoting xiaopeng (1093218247@qq.com):
Is there any possible to convert a string to a symbol, such as "foo"->:foo?
String#to_sym
Carlo
···
Subject: How to convert a string to a symbol?
Date: sab 11 ott 14 10:26:24 +0800
--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
“foo”.to_sym
···
On Oct 11, 2014, at 6:26 PM, xiaopeng <1093218247@qq.com> wrote:
Is there any possible to convert a string to a symbol, such as "foo"->:foo?
You can use to_sym
"foo".to_sym
=> :foo
···
On Sat, Oct 11, 2014 at 7:56 PM, xiaopeng <1093218247@qq.com> wrote:
Is there any possible to convert a string to a symbol, such as
"foo"->:foo?
so quickly, thanks a lot to you and other guys:)
···
On 2014年10月11日 22:28, Joan Roig wrote:
'foo'.to_sym
On Oct 11, 2014 7:27 AM, "xiaopeng" <1093218247@qq.com > <mailto:1093218247@qq.com>> wrote:
Is there any possible to convert a string to a symbol, such as
"foo"->:foo?