| Author |
Comment/Response |
Bill Simpson
|
09/04/12 10:41pm
Is this anything like what you are looking for?
In[1]:= (*fromStringPercent*)
fSP[s_]:=ToExpression[StringReplace[s,"%"->"/100"]];
(*toStringPercent*)
tSP[n_]:=ToString[n*100]<>"%";
a=1;
e1=Which[a==1,"20%",a≠1,"0%"];
e2=Which[a==1,"20%",a≠1,"0%"];
tSP[fSP[e1]+fSP[e2]]
Out[6]= 40%
In[7]:= a=2;
e1=Which[a==1,"20%",a≠1,"0%"];
e2=Which[a==1,"20%",a≠1,"0%"];
tSP[fSP[e1]+fSP[e2]]
Out[10]= 0%
URL: , |
|