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

How to Create a Treeview Menu in ASP.NET with C#?

1 Answers  


Give the code for Handling Mouse Events?

0 Answers  


program for addition of fraction(M/N + P/Q = Y/Z)

1 Answers   Mind Tree,


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  


Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.

1 Answers   Cognizant,






Code for Reading and writing from a file?

0 Answers   IBM, Xoriant,


Write a program to input an integer and - display the reverse - display the sum of each digit - should include logic that considers the input number as any number of digits long

2 Answers   Mind Tree,


"c sharp" code for factorial using static variables

9 Answers  


How to Link Different Data Sources Together?

0 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,


working with arrays

1 Answers  


How to export 2 datatables of a single dataset to 2 different worksheets of a single MSExcel file ?

0 Answers   Eastcom Systems,


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)