java字符串和数值互转的方法

import com.java.justtest.beReferToJT;

// 备份原来的代码
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
if (first) {
first = false;

/* TODO: Your code here. (Using info fields)

FieldHelper infoField = get(Fields.Info, "info_field_name");

RowSet infoStream = findInfoRowSet("info_stream_tag");

Object[] infoRow = null;

int infoRowCount = 0;

// Read all rows from info step before calling getRow() method, which returns first row from any
// input rowset. As rowMeta for info and input steps varies getRow() can lead to errors.
while((infoRow = getRowFrom(infoStream)) != null){

  // do something with info data
  infoRowCount++;
}
*/

}

Object[] inputRow = this.getRow();

if (inputRow == null) {
setOutputDone();
return false;
}

// It is always safest to call createOutputRow() to ensure that your output row’s Object[] is large
// enough to handle any new fields you are creating in this step.

Object[] outputRow = createOutputRow(inputRow, data.outputRowMeta.size());

//1 字符串
//String Id = get(Fields.In, “id”).getString(inputRow);
String newMyother = get(Fields.In, “myother”).getString(inputRow);

//2 整形 Integer
Long Id = get(Fields.In, “id”).getInteger(inputRow);

//3 浮点型(double)
//Double Id = get(Fields.In, “id”).getDouble(inputRow);

//处理
//1 id String
//String newId = String.valueOf(Double.parseDouble(Id)+3);

// 2 Integer
String newId = String.valueOf(Id+3);

//3 double
//String newId = String.valueOf(Id+3);

get(Fields.Out, “newid”).setValue(outputRow, newId);
get(Fields.Out, “newmyother”).setValue(outputRow, newMyother);

//get(Fields.Out, “id”).setValue(r, (id + 1));
//String id = get(Fields.In, “id”).getString®;

// Send the row on to the next step.
putRow(data.outputRowMeta, outputRow);

return true;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值