0

I was calling a method as given here - to print the total address block.

Address add = AddressManager.getMyAddress(someId);
String totalAddr = FlexibleAddress.getAddressAsString(add , par1, par2);
out.print(totalAddr.toString());

The result of totalAddr.toString() is getting like ,

MyName
AddressLine1
AddressLine2
City

I need to remove the first line (ie MyName here) from this total address block. I have to cut the first line from the jsp page where it is displaying.

Nidheesh
  • 4,390
  • 29
  • 87
  • 150

1 Answers1

0

Try with the below code

totalAddr = totalAddr.substring(totalAddr.indexOf('\n')+1);
out.print(totalAddr.toString());
vjy
  • 1,184
  • 1
  • 10
  • 24
  • In the getAddressAsString method how the new lines are defined? if it is defined using
    instead of finding the index of \n try with
    .
    – vjy Apr 24 '13 at 06:27
  • I have tried with
    . In my java
    was using. But now I am getting like, `BR>AddressLine1 AddressLine2 City`. Why is that BR> is coming at the beginning. Otherwise its working.
    – Nidheesh Apr 24 '13 at 06:52
  • If
    works fine then instead of incrementing the index +1 try incrementing the index +4 as
    contains 4 characters.
    – vjy Apr 24 '13 at 07:10