# Manipulate strings within a list

Let's say I have

Solve[x^4 + 3 == 0, x]


with output

{{x -> -(-3)^(1/4)}, {x -> -i (-3)^(1/4)}, {x ->i (-3)^(1/4)}, {x -> (-3)^(1/4)}}


how do i lose the "x->" part of each string within this list and get something like

{-(-3)^(1/4), -i (-3)^(1/4), i (-3)^(1/4), (-3)^(1/4)}


Thanks for the answers/links. Judging by the answers I realise now that I have formulated my question poorly. I wanted to know how I lose symbols that are in front of a specific symbol. Let's have a look at two more examples:

list={a: horse, b: chicken, c: fish}


how do I lose "a: ","b: ","c: "

or

list2={section 1, section 2, section 3}


how do I lose "section"

-
Related Q/As: this and this ... –  kguler Aug 10 at 17:46
Thanks for your quick response i have edited my question. –  11drsnuggles11 Aug 10 at 18:05
This is the canonical post about how to deal with the list returned by Solve. The other to examples will have to be justified/the context will have to be further explained, I think. –  Pickett Aug 10 at 18:08
öska, my mistake, i've changed it, now it should make more sense ;) –  11drsnuggles11 Aug 10 at 18:15

 lst1 = {{x -> -(-3)^(1/4)}, {x -> -i (-3)^(1/4)}, {x ->  i (-3)^(1/4)},
{x -> (-3)^(1/4)}};
lst2 = {a : horse, b : chicken, c : fish};
lst3 = {section 1, section 2, section 3};
lst4 = {section1, section2, section3};
Last @@@ lst1
(* {-(-3)^(1/4),-(-3)^(1/4) i,(-3)^(1/4) i,(-3)^(1/4)} *)
Last /@ lst2
(* {horse,chicken,fish} *)
Block[{section = 1}, lst3]
(* {1,2,3} *)
StringTake[SymbolName/@lst4, -1]
(* {1,2,3} *)
StringReplace[SymbolName /@ lst4, "section" -> ""]
(* {1,2,3} *)

-

The two cases are different but here is something you can try:

list = {a : horse, b : chicken, c : fish};
list2 = {section 1, section 2, section 3};

list /. x_Pattern :> Last@x

{horse, chicken, fish}

list2 /. section -> 1

{1, 2, 3}

-
Your 2nd one is funny because I just was trying: list2 /. section :> Sequence[] which only gives {2, 3} - and I don't know why the 1 is missing :) –  eldo Aug 10 at 18:39
@eldo Because section*1 == section :D –  Öskå Aug 10 at 19:05

why not simply:

sol = Solve[x^4 + 3 == 0, x]

x /. sol


or

#[[2]] & @@@ sol

(*{-(-3)^(1/4), -I (-3)^(1/4), I (-3)^(1/4), (-3)^(1/4)}*)


for the second Example you can try:

list = {a : horse, b : chicken, c : fish}
#[[2]] & @@@ Transpose[{list}]
(*{horse, chicken, fish}*)

-