kettle 使用javascript2

//注意 从上一个模块引用的变量在代码中要显示的进行getString()转换

var bytes = Packages.org.apache.commons.codec.binary.Base64.decodeBase64( F1.getString().getBytes() );
var decString = new Packages.java.lang.String( bytes );

var encString = new Packages.java.lang.String( Packages.org.apache.commons.codec.binary.Base64.encodeBase64( decString.getBytes() ) );

// 文件名分割

var strArray = File.getString().split("\\\\");
var last = strArray[strArray.length-1];

//STRING 转 INTEGER

var nummerke = Packages.java.lang.Integer.valueOf(Hex.getString(), 16).intValue();

//数字转字符串

var numFromStr = Str.Clone().str2num("€#,###.##", ".", ",", "€").getNumber();
var strFromNum = Num.Clone().num2str("€#,###.##").getString()

//替换字符

value.replace("\n\r", ",").replace("\n", ",");

//清除时间

var date0 = truncDate(dateTime, 0); // gives back today at yyyy/MM/dd HH:mm:ss.000
var date1 = truncDate(dateTime, 1); // gives back today at yyyy/MM/dd HH:mm:00.000
var date2 = truncDate(dateTime, 2); // gives back today at yyyy/MM/dd HH:00:00.000
var date3 = truncDate(dateTime, 3); // gives back today at yyyy/MM/dd 00:00:00.000
var date4 = truncDate(dateTime, 4); // gives back today at yyyy/MM/01 00:00:00.000
var date5 = truncDate(dateTime, 5); // gives back today at yyyy/01/01 00:00:00.000

//获得前一个步骤输出的每一行


for (var i=0;i

你可能感兴趣的:(kettle 使用javascript2)