Skip to content

Instantly share code, notes, and snippets.

@maraigue
Created April 30, 2009 08:31
Show Gist options
  • Select an option

  • Save maraigue/104347 to your computer and use it in GitHub Desktop.

Select an option

Save maraigue/104347 to your computer and use it in GitHub Desktop.
与えられた文字列の先頭が、特定の文字(ASCIIに限定してよい)であるか判定(Ruby1.8, 1.9共通)
#!/usr/bin/env ruby
# 与えられた文字列の先頭が "#" であるか判定
def comment?(str)
str[0] == "#"[0]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment