Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3321604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:04:58+00:00 2026-05-17T23:04:58+00:00

var.split(‘/’).delete_at(0) upon inspection returns no matter what the string, however…. var.split(‘/’) var.delete_at(0) gives me

  • 0
   var.split('/').delete_at(0)

upon inspection returns

"" 

no matter what the string, however….

   var.split('/')
   var.delete_at(0)

gives me no trouble. this is probably a stupid question, but are there some sort of restrictions/limitations regarding method chaining like this?

thanks,
brandon

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:04:58+00:00Added an answer on May 17, 2026 at 11:04 pm

    The delete_at method deletes the element but returns the deleted element not the new array.

    If you want to always return the object, you can use the tap method (available since Ruby 1.8.7).

    a = [1, 2, 3, 4, 5, 6, 7]
    a.delete_at(0) # => 1
    a # => [2, 3, 4, 5, 6, 7]
    
    a = [1, 2, 3, 4, 5, 6, 7]
    a.tap { |a| a.delete_at(0) } # => returns [2, 3, 4, 5, 6, 7]
    a # => [2, 3, 4, 5, 6, 7]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

string accessToken = GetAccessToken(); string accessKey = accessToken.Split('=')[1]; var client = new FacebookClient(accessKey); dynamic
foreach (string x in Value.Split('|')) { var y = x.Split(','); if (y.Length == 1)
if I have a string e.g. var myStr="AAAAAAA BBBBB CCCCC DDDDD..." , this string
var t1 = from line in File.ReadAllLines(@alkahf.txt) let item = line.Split(new string[] {. },
I have this script: var a=Thu Oct 07 16:50:0 CEST 2010; var b=a.split(CEST); var
var gethtml = $(#topmenu > li.l89 a).text().split(' ')[1].replaceWith('Any World'); The text is not changing
how to split an array index i.e.. sample code var parts = currentVal.split( );
I have the following for loop: for (loc in locations){ var newLoc = locations[loc].split(,
my data is dat1; the split statement is var splitstr = dat1.split(-); I have
http://jsfiddle.net/skowron_line/zPCBc/1/ var d1 = '31.05.2012'; var d2 = '01.06.2012'; var s1 = d1.split('.'); var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.