ruby - After performing string.slice() return string with part removed -


I'm sure it is very clear, but I think it is difficult to work. I have a pathname example and I try to remove the first directory of it and then go back to the rest of the string, but the piece removes the part, it seems that little string is no way to get back.

  Filepth = Ptnmekni ( "This_folder_needs_to_go / Another_folder / Failkhtml") Filedir = Filepthkto_skslais ( "This_folder_needs_to_go /") Newfilepth = Filir   

hope newfilepath will another_folder / file.html , but instead it just this_folder_needs_to_go / < P>, how will I get to earth on which the part of the string has been removed?

Use:

  "This_folder_needs_to_go / another_folder / file.html ".split ('/', 2) [1] # = & gt; "Other_folder / file.html"    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -