brewersfan1976

is_case_insensitive_palindrome.rb

Sep 25th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.47 KB | None | 0 0
  1. def isCaseInsensitivePalindrome(inputString)
  2.     string = inputString.downcase
  3.     x = 0
  4.     string_1 = ""
  5.     string_2 = ""
  6.    
  7.     while (x < string.length)
  8.           string_1 = string_1 + string[x]
  9.           x = x + 1
  10.     end
  11.    
  12.     x = string.length - 1
  13.    
  14.     while (x >= 0)
  15.           string_2 = string_2 + string[x]
  16.           x = x - 1
  17.     end
  18.    
  19.     if string_1 == string_2 then
  20.        return true
  21.     else
  22.        return false
  23.     end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment