Skip to content

Instantly share code, notes, and snippets.

@100lp
Last active December 14, 2015 04:49
Show Gist options
  • Save 100lp/5030853 to your computer and use it in GitHub Desktop.
Save 100lp/5030853 to your computer and use it in GitHub Desktop.
# On 2/20/13, at 01:30, Alexey Gaziev wrote: > посмотрите информацию по методу match у String <br /> [*On 2/20/13, at 01:30, Alexey Gaziev wrote:*] > и по методу =~ [19:14:26] Alexey Gaziev: посмотрите и сделайте мне следующую тему - [19:14:32] Alexey Gaziev: 1. В метод приходит строка [19:15:00] Alexey Gaziev: 2. Если строка содержит в начале ч…
def alex(string)
if string[0] == "1"
1
elsif string[/[123]/]
555
else
0
end
end
puts alex("111jshfskjh24324r3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment