Questions tagged [upcase]

21 questions
2
votes
2 answers

upcase in rails

This is very basic but not working. I want to add a callback (after_save) to upcase a field input. In my model I have: after_save :upcase_tax_label def upcase_tax_label self.tax1_label.upcase! self.tax2_label.upcase! end So when I edit it…
Olivier
  • 661
  • 2
  • 10
  • 13
2
votes
2 answers

upcase and downcase for accented characters

I'm a beginner working on a simple Ruby program to generate vocabulary lists from text files. Spanish allows words to carry stress marks on capitalized first letters (e.g. "Ábaco"), but I want all words in my list to be downcased. Right now, if I…
gonzalo2000
  • 628
  • 1
  • 8
  • 22
2
votes
1 answer

Weird behavior of #upcase! in Ruby

Consider the following code: @person = { :email => 'hello@example.com' } temp = @person.clone temp[:email].upcase! p temp[:email] # => HELLO@EXAMPLE.COM p @person[:email] # => HELLO@EXAMPLE.COM, why?! # But temp[:email] = 'blah@example.com' p…
Andrey Esperanza
  • 625
  • 1
  • 6
  • 11
2
votes
2 answers

Proper Case'ing without breaking things like IBM, NASA etc

Does anyone has a PHP solution to this? The goal is to have a function that take these HELLO WORLD hello world Hello IBM and return these Hello World Hello World Hello IBM respectively.
Average Joe
  • 4,521
  • 9
  • 53
  • 81
1
vote
3 answers

Using upcase function in SAS programming?

Very new to SAS programming 0.0 I am trying to change the title "Listing of Data Set Health" to all uppercase and what I am doing isn't working. PLS HELP. proc format; value $Gender 'M'='Male' 'F'='Female' other= 'Unknown'; * Handle Missing…
Hillary Oh
  • 21
  • 2
1
vote
2 answers

Ruby - str.upcase isn't working in a while loop

I've written code to take a string and return the same string back with all the letters changed to the next one and vowels uppercased. However, when I try to run it, the vowels don't seem to uppercase like I expect. This is my code: def…
1
vote
1 answer

SAS format procedure, invalue statement ,UPCASE option does not work

I need to create SAS informat that will change all case versions of 'Male' and 'Female' to digits. I found in the documentation that there is UPCASE options that does the job. "converts all raw data values to uppercase before they are compared to…
John Overiron
  • 517
  • 1
  • 5
  • 20
1
vote
2 answers

Why a dangerous method doesn't work with a character element of String in Ruby?

When I apply the upcase! method I get: a="hello" a.upcase! a # Shows "HELLO" But in this other case: b="hello" b[0].upcase! b[0] # Shows h b # Shows hello I don't understand why the upcase! applied to b[0] doesn't have any efect.
Carlos Rojas
  • 95
  • 2
  • 6
1
vote
1 answer

Hartl Rails Tutorial: upcase-ing email address in user_test

I'm about halfway through the Rails tutorial (excellent, btw), and have a little question. Is there a reason that this test uses duplicate_user.email = @user.email.upcase and not the more succinct duplicate_user.email.upcase ? Here is the full…
JuliaV
  • 13
  • 2
0
votes
3 answers

is there a function to capitalize an obj accessed with str[i] in Ruby?

print str[i].upcase is not working and i have to capitalize specific letters determined using an index. Can someone help me with this? def mumble_letters str = nil print "Please write a string : " str = gets.to_str # puts str.length …
Ioana C
  • 1
  • 1
0
votes
1 answer

Re-open String class and add .upcase method in Ruby

Task: In Ruby I have to re-open the String class and add a new functionality my_new_method that calls the upcase method. "abc".my_new_method returns "ABC" I have tried with this code but the test said wrong number of arguments (0 for 1) # Re-open…
0
votes
1 answer

Combining a string with capitalized hex seems to erase the first string

I'm trying to concat a SQL query string and a hex string that should be capitalized. hURL -X -s takes a string or file and coverts it to hex. cmd = "/root/Desktop/pentest/tools/hURL/hURL -X -s " + md5_got.chomp.delete("\n").to_s md5_tohex =…
Dan Miller
  • 261
  • 2
  • 7
0
votes
2 answers

How to have the user input alternate between uppercase and lowercase in Ruby?

I have Ruby ask the user five times to enter a name, and want the answers to be spat out with each line to alternate with uppercase and lowercase. Below is what I have done and it prints out each name twice, one uppercase one lowercase. But I just…
Spidermonkey
  • 21
  • 1
  • 1
0
votes
2 answers

Ruby: Reverse only the first 100 characters of a string

I'm trying to do some string manipulation on a string in Ruby. The goal is to strip, reverse, squeeze and upcase only the first 100 characters without affecting the rest of the string. Here is the string we will work with. The line numbers are part…
amoeboar
  • 355
  • 1
  • 4
  • 22
0
votes
2 answers

.upcase! makes if statement fail to work properly

begin puts "Enter selection:\n\n" $main = gets.chomp if $main.upcase! == "A" call_function_1 elsif $main.upcase! == "B" call_function_2 end end while $main != "~" With the code as it…
1
2