Sign up or Sign in | Share
 
ClearMyBench
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Ruby basics (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Ruby basics
#4427
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
str.upcase

Returns a copy of str with all lowercase letters replaced with their uppercase counterparts. The operation is locale insensitive.only characters a to z are affected.


str.upcase!

Changes the contents of str to uppercase, returning nil if no changes are made.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4428
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
str.unpack(format)


Decodes str (which may contain binary data) according to the format string, returning an array of each value extracted.

The format string consists of a sequence of single-character directives.

Each directive may be followed by a number, indicating the number of times to repeat with this directive. An asterisk (*) will use up all
remaining elements.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4429
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
str.tr!(from_str, to_str)

Translates str in place, using the same rules as String#tr. Returns str, or nil if no changes were made.

str.tr_s(from_str, to_str)

Processes a copy of str as described under String#tr, then removes duplicate characters in regions that were affected by the translation.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4430
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
str.rstrip

Returns a copy of str with trailing whitespace removed.

str.rstrip!

Removes trailing whitespace from str, returning nil if no change was made
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4431
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
str.scan(pattern) [or] str.scan(pattern) { |match, ...| block }


Both forms iterate through str, matching the pattern (which may be a Regexp or a String).

For each match, a result is generated and either added to the result array or passed to the block. If the pattern contains no groups, each individual result consists of the matched string, $&


. If the pattern contains groups, each individual result is itself an array containing one entry per group.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4432
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
str.match(pattern)

Converts pattern to a Regexp (if it isn't already one), then invokes its match method on str.

str.oct

Treats leading characters of str as a string of octal digits (with an optional sign) and returns the corresponding number. Returns 0 if the conversion fails.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
get the latest posts directly to your desktop
logo footer   Copyright 2009 - 2013 HotRecruiter.Com - All Rights Reserved