cancel
Showing results for 
Search instead for 
Did you mean: 

Java concatenation with an offset

Former Member
0 Kudos

Hi Javaman,

I work on PI and I'm facing to stupid pb: easy in abap, but in Java is another story...

Here's what I want to do in Java (especially inside SAP PI):

Source = abcdefgh.

Target = 1234567

Target+10(6) = Source(6).

Thus result should be: Target = "1234567 abcdef" with three spaces coz the first part is on 10 characters.

My pb is not to get the 6 char of Source (cf. fct substring), but it's the managment of the offset "+10".

£#$% ??!!

Thanks

Mickael

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Use StringBuffer (it's better then concatenate Strings)

StringBuffer bf = new StringBuffer();
bf.append("1234567   ");
bf.append("abcdefgh");
String source = bf.subString(10).toString();

Refer to javadocs of StringBuffer for details.

Regards,

Daniel