Hi,
Which command can use for deleting empty space for the below list?
S1 = {"5", "10", "7", "", "", "", "", ""}
Thank for your help.
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,""]
?
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] &]