program to reverse the order of words in a string.

Answers were Sorted based on User's Feedback



program to reverse the order of words in a string...

Answer / hrushikesh

Public Class Form1

Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim str As String
Dim words As String()

str = TextBox1.Text
words = Split(str)

Label1.Text = String.Empty

For i As Integer = words.Length - 1 To 0
Step -1
Label1.Text += words(i) + " "
Next
End Sub

Is This Answer Correct ?    4 Yes 7 No

program to reverse the order of words in a string...

Answer / snehu

import java.io.*;
import java.lang.*;

public class StringReverse
{
public static void main(String[] args)throws Exception
{
String words = "hi frends........ welcome to my
world";


String reverse = new StringBuffer(words).reverse
().toString();


System.out.println("Normal : " + words);

System.out.println("Reverse: " + reverse);
}
}

Is This Answer Correct ?    3 Yes 12 No

Post New Answer

More C Sharp Code Interview Questions

Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }

0 Answers  


Coding for Manipulate XML File Data Using C#?

1 Answers  


Write a program to count 3Letter, 4Letter and 5Letter words from a file and print the number of 3Letter, 4Letter and 5Letter words. Delimiter is space, tab, hifen. Also we should not consider the line in the file after we encounter # in that line.

0 Answers   Mind Tree,


How to find No of classes,Packages,No of Methods per Classes and Depth of Inheritance for selecting source code in windows form application using c# .net? (Source code is input Program. It may be Java or .net) Please help me..) Thanks..)

0 Answers  


How to Link Different Data Sources Together?

0 Answers  






working with arrays

1 Answers  


<ul> <li id="Accommodation" runat="server" visible="false"><a href="../Elements/frmSearchAccommodation.aspx?submenuheader=1">Accommodation</a></li> <li id="Arts" runat="server" visible="false"><a href="../Elements/frmSearchProp.aspx?submenuheader=1">Arts And Props</a></li> <li id="Costume" runat="server" visible="false"><a href="../Elements/frmSearchCostume.aspx?submenuheader=1">Costume</a></li> <li id="Crew" runat="server" visible="false"><a href="../Elements/frmSearchCrew.aspx?submenuheader=1">Crew</a></li> <li id="Catering" runat="server" visible="false"><a href="../Elements/frmSearchCatering.aspx?submenuheader=1">Catering</a></li> <li id="Equipment" runat="server" visible="false"><a href="../Elements/frmSearchEquipment.aspx?submenuheader=1">Equipment</a></li> <li id="Film" runat="server" visible="false"><a href="../Elements/frmSearchFilmTapeStock.aspx?submenuheader=1">Film And Tape Stocks</a></li> <li id="Location" runat="server" visible="false"><a href="../Elements/frmSearchLocation.aspx?submenuheader=1">Location</a></li> <li id="Picture" runat="server" visible="false"><a href="../Elements/frmSearchPictureVehicle.aspx?submenuheader=1">Picture Vehicles</a></li> <li id="Production" runat="server" visible="false"><a href="../Elements/frmSearchProductionSupplies.aspx?submenuheader=1">Production Supplies</a></li> <li id="Post" runat="server" visible="false"><a href="../Elements/frmSearchPostProductionHouse.aspx?submenuheader=1">Post Production Houses</a></li> <li id="Rigging" runat="server" visible="false"><a href="../Elements/frmSearchRigging.aspx?submenuheader=1">Rigging</a></li> <li id="Stunt" runat="server" visible="false"><a href="../Elements/frmSearchStunt.aspx?submenuheader=1">Stunt</a></li> <li id="Studio" runat="server" visible="false"><a href="../Elements/frmSearchStudio.aspx?submenuheader=1">Studio</a></li> <li id="SFX" runat="server" visible="false"><a href="../Elements/frmSearchSFX.aspx?submenuheader=1">SFX</a></li> <li id="Talents" runat="server" visible="false"><a href="../Elements/frmSearchTalent.aspx?submenuheader=1">Talents</a></li> <li id="Transport" runat="server" visible="false"><a href="../Elements/frmSearchTransport.aspx?submenuheader=1">Transport</a></li> <li id="Venue" runat="server" visible="false"><a href="../Elements/frmSearchVenue.aspx?submenuheader=1">Venue</a></li> <li id="Other" runat="server" visible="false"><a href="../PageUnderConstruction.aspx?submenuheader=1">Other</a></li> </ul> I have this code in leftmenu.ascx page..now on leftmenu.ascx.cs page i want to access id values. but i dont want to check manually like Accommodation,Arts etc.. In cs file my code is like string str[]; //this array contains some values say 10 strings for(i=0;i<100;i++) { if(str[i]==id id.visible=true } i.e.i want to travel for each element of str and each value of id.if they match then id.visible=true how to do?

0 Answers  


Write a program to count the number of characters, number of words, number of line in file.

2 Answers   Mind Tree,


c# code to Count number of 1's in a given range of integer (0 to n)

0 Answers  


Give the code for Handling Mouse Events?

0 Answers  


How to use ASP.NET 2.0's TreeView to Display Hierarchical Data?

1 Answers  


"c sharp" code for factorial using static variables

9 Answers  


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)