Questions tagged [upcase]

21 questions
0
votes
2 answers

Loop won't break and string won't capitalize properly?

I am trying to get a simple Ruby program to run correctly. I need it to take user input until the user types q for "quit". It also needs to capitalize the last four letters of the users input and, with input under four letters, to capitalize all…
deefish
  • 17
  • 3
0
votes
4 answers

Ruby string upcase! method - uppercasechar.upcase! returns nil - bug or feature?

puts 'A'.upcase! returns nil. This is kind of confusing, especially since 'Ab' returns 'AB', not 'B'. Is this a bug or a language quirk? edit so I see the docs, but it still seems counterintuitive. When would this make sense in a real usage…
inman320
  • 501
  • 3
  • 13
0
votes
1 answer

str_replace doesn't work with array arguments on PHP

The following code doesn't work on PHP. The actual result: 'ЯЯЯ' -> 'ЯЯЯ' (should be 'яяя') Why? function strtolower_rus($string) { $upper =…
Dmitry
  • 14,306
  • 23
  • 105
  • 189
-1
votes
3 answers

How to prevent iterating over duplicate array elements?

Is it possible to avoid messing with duplicate array elements when you're messing with the first one? Consider the following: def rot13(str) alphabet = ("a".."z").to_a letters = str.split("").each{|x| x.downcase! } letters.map! do |let| …
Andrea McKenzie
  • 239
  • 1
  • 12
-2
votes
1 answer

Ruby Array Index - Every other word upcase

wordSort.sort! =begin Conditional is performed on the array: if array index is equal to zero or has a remainder of zero after being divided by 2 then call upcase method on element. Else call lowercase method on that index number. =end puts…
-6
votes
1 answer

anyone that can help me with arrays within upcase chars and loops Delphi 7 ?

here is my code : var aChar,temp : char ; test : string ; k : integer ; begin K := 1 ; test := edit1.Text ; for k := 1 to 10 do temp := test[k] ; aChar := upcase(Temp) ; richEdit1.Lines.Add(aChar); richEdit1.Lines.Add(#13) ; end; for some reason…
1
2