[?] Delete empty spaces in a list?

Hi,

Which command can use for deleting empty space for the below list?

S1 = {"5", "10", "7", "", "", "", "", ""}

Thank for your help.

DeleteCases[S1 /. β€œβ€ β†’ x, x]
(* {β€œ5”, β€œ10”, β€œ7”} *)

An interesting solution!
Many thanks, Mariusz.

Why not simply:

DeleteCases[S1,""]

?

Hi Sander,

Sander is correct. You typed what he posted incorrectly. You want to delete the empty strings so you must enter “”, not Β“,Β”

Regards

I know it’s not the same thing as deleting, but with the Drop command also arrives at the same result.

S1 = {"5", "10", "7", "", "", "", "", ""};
Drop[S1, {-5, -1}]
(* {5,10,7} *)

You right Sander.
I appreciate your help.

A more general approach if you only want to select the stings that actually are a number.

Select[S1, StringMatchQ[#, NumberString] &]