السـلام عليكم ورحمه الله وبركاته
برنامج WC Ruby Edition عباره عن سكربت بسيط تقوم بتمرير ملف نصي لـه فيقوم بحسـاب عدد الكلمات والحروف والجمل وعدد الاسطر والفقرات الموجوده بـه .
بالطبـع الاسكربت مكتوب بالـ Ruby
Programmer's Best Friend:thumpsup_green: <<<<
بالطبـع الاسكربت مكتوب بالـ Ruby
Programmer's Best Friend:thumpsup_green: <<<<
كود:
#!/usr/bin/ruby puts "\t\tTh1S C0dE WaS WrittEn By" puts "\t\t\tMutati0N" puts "\t\tU N33D 2 l3arN M0r3!!!\n\n" lines = File.readlines("parag.txt")#puts Here The Path 0F The txt File 0r The Name 0F The File if His in The Same directory The Source cod is . lines_number = lines txt=lines.join spaces = txt.gsub( /\s+/ , '' ) sentences = txt.split(/\.|\?|!/) paragraphs = txt.split(/\n\n/) puts "\t(ThE Length 0F lines are: #{lines_number.size})" puts "\t(ThE Number 0F charachters are:#{txt.size})" puts "\t(ThE Number 0F Charachter Without Spaces are:#{spaces.length})" puts "\t(ThE Number 0F W0rds are :#{txt.split.length})" puts "\t(ThE Number 0F Sentences are : #{sentences.size})" puts "\t(ThE Number 0F Paragraphs are :#{paragraphs.length})" ##EnD 0F My C0dE!!!
تعليق