C# How can i swap the first with the last character from a string -
C# How can i swap the first with the last character from a string -
id create method: public static string frontback(string str) {}
this method should exchange first char lastly char.
for illustration : console.writeline(frontback("code"));
so in case i'd replace char "c" "e" , result should eodc.
public static string frontback(string str) { int len = str.length; homecoming str[len-1] + str.substring(1,len-2) + str[0]; }
c# string
Comments
Post a Comment