StringBuilder を使用して 25 の長さを設定し、そのフィールド内の特定の位置に文字列値を入力しようとしているフィールドがあります。ただし、そのフィールドの値を出力すると、値は次のようになります。
M�����������0��������������
明らかに、そのフィールドから「�」値を削除する必要があります。ヘルプ/指示をいただければ幸いです。
これが私のコードです:
String b44 = toRequestIsoMessage.getString(B44_ADD_RESPONSE_DATA.bitId);
if (b44 == null) {
// ***** 20130604 MS - Told Ralph since that position 1 is space filled initially in the request to the CORE so that he can modify for the AVS. *****
String avsValue = " ";
try {
StringBuilder revB44Value = new StringBuilder();
revB44Value.setLength(25);
revB44Value.insert(0, avsValue);
if (decision.cidResponse.responseCode != null) {
revB44Value.insert(1, decision.cidResponse.responseCode);
} else {
revB44Value.insert(1, " ");
}
if (decision.cvvResponse.responseCode != null) {
revB44Value.insert(13, decision.cvvResponse.responseCode);
} else {
revB44Value.insert(13, " ");
}
String revB44 = revB44Value.toString();
toRequestIsoMessage.setString(B44_ADD_RESPONSE_DATA.bitId, revB44Value.toString());
} catch (InternalISOMsgException e) {
LOGGER.info(FormatData.fullStackTrace(e));
}
}