Jump to content

User talk:Maankarate

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 203.99.221.151 (talk) at 09:35, 7 April 2014. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Read the question properly.Assign the answer to output1 variable.Given a method taking a person name in
       the format - "FirstName LastName". Write code to return the person name in the following format - "LastName, InitialOfFirstName". 

Example: input: Jessica Miller output: Miller, J

Note :- Do not rename any input / output variables and

   method signatures. Assign your final values to ‘Output1’ variable with proper typecasting (if required).

1. string[] ss = input1.Split(' ');

           StringBuilder sb = new StringBuilder();
           sb.Append(ss[1].Substring(0,1).ToUpper()+ss[1].Substring(1));
           sb.Append(", ");
           sb.Append(ss[0].Substring(0, 1).ToUpper());
           string output1 = sb.ToString();