[英]Crystal Report Formula - Get numeric from alphanumeric characters
I need a way to extract a numeric value from an alphanumeric one, for example : 我需要一种从字母数字值中提取数字值的方法,例如:
3 MS 15 SEC
Desired: 期望:
3.15
Try: 尝试:
Local NumberVar i;
Local StringVar k;
for i:=1 to Count (Split("3 MS 15 SEC"," ")) do
(
if NumericText (Split("3 MS 15 SEC "," ")[i]) then (
k:=k+Split("3 MS 15 SEC "," ")[i]+".";
)
);
if k<>"" then
k[1 to length(k)-1]
else
k //drop final "."
Try: 尝试:
// {@extract}
Local Stringvar Array tokens:=Split(x);
Local Stringvar Array values;
Local Numbervar i;
for i := 1 to uBound(tokens) do (
if isNumeric(tokens[i]) then (
redim preserve values[ubound(values)+1];
values[ubound(values)]:=tokens[i];
)
);
ToNumber( Join(values,".") );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.