Demonstrate string arrays : String Array « Data Types « C# / C Sharp






Demonstrate string arrays

Demonstrate string arrays
  
/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Demonstrate string arrays.  
 
using System; 
 
public class StringArrays {  
  public static void Main() {  
    string[] str = { "This", "is", "a", "test." };  
  
    Console.WriteLine("Original array: ");  
    for(int i=0; i < str.Length; i++) 
      Console.Write(str[i] + " ");  
    Console.WriteLine("\n");  
  
    // change a string  
    str[1] = "was";  
    str[3] = "test, too!";  
  
    Console.WriteLine("Modified array: "); 
    for(int i=0; i < str.Length; i++) 
      Console.Write(str[i] + " ");  
  }  
}

           
         
    
  








Related examples in the same category

1.Generates a hashcode for the string array
2.removes the specified strings in the string array from the input string
3.Count how many times a word appears in an array of words.
4.Find all unique words in an array of words.
5.Gets an array of sentences from a string.
6.Array To New Line Separated String
7.New Line Separated String To Array
8.returns the elements of the array as a string, delimited with the default delimitor
9.Ensures that a given array can hold up to minCapacity elements.
10.Strings to byte array.
11.String Array To String
12.Processes a string and returns the arguments in an array.
13.String To Char ArrayString To Char Array
14.Comparing string to char array