CSharp examples for System:String Format
Return a sub array of this string array.
/*//from w w w . j av a2 s .c o m * @version : 2.5.0 * @author : Ext.NET, Inc. http://www.ext.net/ * @date : 2014-10-20 * @copyright : Copyright (c) 2008-2014, Ext.NET, Inc. (http://www.ext.net/). All rights reserved. * @license : See license.txt and http://www.ext.net/license/. * @website : http://www.ext.net/ */ using System.Web.UI; using System.Web; using System.Text.RegularExpressions; using System.Text; using System.Security.Cryptography; using System.Globalization; using System.ComponentModel; using System.Collections.Generic; using System.Collections; using System; public class Main{ /// <summary> /// Return a sub array of this string array. /// </summary> [Description("Return a sub array of this string array.")] public static string[] Subarray(this string[] items, int start, int length) { if (start > items.Length) { throw new ArgumentException(string.Format("The start index [{0}] is greater than the length [{1}] of the array.", start, items.Length)); } if ((start + length) > items.Length) { throw new ArgumentException(string.Format("The length [{0}] to return is greater than the length [{1}] of the array.", length, items.Length)); } string[] temp = new string[length]; int count = 0; for (int i = start; i < start + length; i++) { temp[count] = items[i]; count++; } return temp; } /// <summary> /// Return a sub array of this string array. /// </summary> [Description("Return a sub array of this string array.")] public static string[] Subarray(this string[] items, int start) { return items.Subarray(start, items.Length - start); } }