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 can i split sting in textbox in windows application using c# .net

2 Answers  


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

0 Answers  


Coding for using Nullable Types in C#?

1 Answers  


Code for Searching for Multiple Matches with the MatchCollection Class?

0 Answers   TCS,


Write a function which accepts list of nouns as input parameter and return the same list in the plural form. Conditions: i) if last letter is r then append s ii) if word ends with y then replace it by ies iii) call this function in main() and produce the required output. for eg:- if chair is input it should give chairs as output.

0 Answers   Mind Tree,






Give the code for Handling Mouse Events?

0 Answers  


program to reverse the order of digits in a given number of any length.

1 Answers   Mind Tree,


How to Link Different Data Sources Together?

0 Answers  


how to get the table names via c sharp and column names also?

2 Answers   Sify,


c# coding for a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors not using the Big-integer and Exponential Function's.

1 Answers   TCS,


Code for Reading and writing from a file?

0 Answers   IBM, Xoriant,


working with arrays

1 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)