DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR RUBY
ruby sort array numerically
a
=
[
"teste"
,
"test"
,
"teste2"
,
"tes3te"
,
"10teste"
]
a
.
sort_by
!
{
|
s
|
s
[
/
d
+
/
]
.
to_i
}
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#ruby
#sort
#array
#numerically
ADD COMMENT
Topic
COMMENT
Name
6+9 =
Submit