U
Ulf
I'm looking for the best way to combine two strings so that the result
ends with the 2:nd string in position 30-32. The 1:st string is 1 to
30 chars long.
Currently I use the following (untested) code.
char cc[] = new char[33];
for(int i = 0; i < 33; i++) { cc = ' '; } //Make spaces
cc[30] = '/'; // This is the 3 chars for string2
cc[31] = '0';
cc[32] = '0';
string1.getChars(0,string1.length()- 1, cc, 0);
resultString = new String(cc);
I would appreciate suggestions both on the solution (perhaps this is
the best solution) and proper Java coding.
This operation will be used just a few times a day, so the solution
really doesn't matter for the project, but it matters for me trying to
learn Java.
/Ulf
ends with the 2:nd string in position 30-32. The 1:st string is 1 to
30 chars long.
Currently I use the following (untested) code.
char cc[] = new char[33];
for(int i = 0; i < 33; i++) { cc = ' '; } //Make spaces
cc[30] = '/'; // This is the 3 chars for string2
cc[31] = '0';
cc[32] = '0';
string1.getChars(0,string1.length()- 1, cc, 0);
resultString = new String(cc);
I would appreciate suggestions both on the solution (perhaps this is
the best solution) and proper Java coding.
This operation will be used just a few times a day, so the solution
really doesn't matter for the project, but it matters for me trying to
learn Java.
/Ulf