Created
September 20, 2012 15:50
-
-
Save judsonbsilva/3756733 to your computer and use it in GitHub Desktop.
Pega um arquivo de texto troca vogais por '-' e salva em outro arquivo de texto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Processo recebe o local do arquivo, e onde será salvo o novo arquivo | |
hyphen = proc { |from, to| | |
#Cria um novo arquivo de texto | |
text = File.new( to ,'w') | |
#Salva no novo arquivo de texto o conteúdo do (arquivo com as vogais) alterado pela Regexp | |
text.puts File.read( from ).gsub(/[aeiou]/i,"-") | |
#Fecha o arquivo | |
text.close | |
} | |
#Chama o processo passando os argumentos pelo terminal | |
hyphen.call( ARGV[0], ARGV[1] ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment