Ruby Programming - 15 - Find and Replace Program

Поделиться
HTML-код
  • Опубликовано: 13 дек 2024

Комментарии • 16

  • @36tonystarks
    @36tonystarks 10 лет назад

    Awesome video my dude I'm learning alot from you!

  • @AndyW504
    @AndyW504 9 лет назад

    Great videos! Any way to not make the removal case-sensitive?

  • @biscoito1r
    @biscoito1r 9 лет назад +1

    The Plaintiff Blackburn has requested that the defendant no longer contact her.

  • @tactteam00
    @tactteam00 8 лет назад

    Is it necessary to put parentheses around the quotes in the if/else statement? I used just quotes with a space and it seemed to work ok

  • @desmondade
    @desmondade 8 лет назад

    hi thanks Jake what is the function of .each do ?

  • @Bhatim1
    @Bhatim1 8 лет назад

    What if i have multiple identifiers like space, coma, pull stop in the document. could you please explain

  • @wendycampbell8101
    @wendycampbell8101 10 лет назад

    Why do the speech marks in + (" ") need to be in parenthesis?

    • @samaugust85
      @samaugust85 9 лет назад +1

      Wendy Campbell they do not need parentheses, actually. because we are just concatenating a string, all you need are the quotation marks to designate it as a string.

  • @olexanderburyak6613
    @olexanderburyak6613 11 лет назад +1

    u shall try to remove a word "her" that dot in the end of the sentence doing bad things. actually, any punctuation will break that rule we did.

  • @bwinborg
    @bwinborg 10 лет назад

    Her is the program from day 15
    #!/usr/bin/env ruby
    puts "Paste your document here:"
    document = gets.chomp
    puts "What word would you like removed?"
    remove = gets.chonp
    target_word = document.split(" ")
    target_words.each do |a_word|
    if a word != remove
    print a word + (" ")
    else print "RMOVED "
    end
    end
    When I pull it into the Command prompt I receive an error
    Any suggestions

    • @DerpyFelicia
      @DerpyFelicia 9 лет назад

      you did if a word != remove its if a_word != remove

    • @DerpyFelicia
      @DerpyFelicia 9 лет назад

      Brad Winborg you also did remove = gets.chonp

  • @ey_yosup7278
    @ey_yosup7278 9 лет назад

    I dont understand the space

  • @victorsalvans8544
    @victorsalvans8544 10 лет назад

    could be as simple as that? text[word] = replace

  • @DerpyFelicia
    @DerpyFelicia 9 лет назад

    Wild Academy great job teaching please respond but this is the way to get it so you could just open the file and not command promp
    puts "Paste Your Document Here"
    document = gets.chomp
    puts "What word would you like removed"
    remove = gets.chomp
    puts "What word would you like there instead"
    target_words = document.split(" ")
    new_word = gets.chomp
    target_words.each do |a_word|
    if a_word != remove
    print a_word + (" ")
    else print new_word + (" ")
    puts ",press enter to close the program"
    end_program = gets.chomp
    end
    end

  • @MarcoCarmonaT
    @MarcoCarmonaT 8 лет назад

    There's a gem that reads your clipboard to make Ruby detects what you have copied before, just saying...