format a variable value in View -- MVC

pratikshahse used Ask the Experts™
In my view I am getting an address value from my model.

Address is coming up as

adressline 1 | adress line 2 | City | State | zip

I wont this to be formatted in such a way that it shows up as

addressline 1
City, State, Zip
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015

Check this code. Make sure you have all the values else you will get Index Error.
        var address = "adressline 1 | adress line 2 | City | State | zip";
        string[] arr = address.Split('|');

        <p>@arr[2], @arr[3], @arr[4]</p>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial