English 中文(简体)
位于Array的数据,长度相同
原标题:Allocating data in Array with same length string

I am stuck in allocating data in array. for example i have 100 words in paragraph now i want to make array which contain 10 words in each array slot but not break words mean "Hello" in one slot would be "hel" and in second slot rest of word "lo".

谁能知道如何执行?

我的段落像我这样说。

hi how are you whats going on
 Google Translate API for .NET 0.4 alpha
¶ Description: Provides a simple, unofficial, .NET Framework API for using Google Ajax Language API service. Feature:
* tyle5">Support all functions of Google Ajax Language API.
* CLS compatible. It can be used by any .NET languages (VB.NET, C++/CLI etc.) Versions: Google Search API for .NET comes in different versions for the various .NET frameworks. * .NET Framework 3.5 Client Profile.
 * .NET Framework 2.0
 * .NET Compact Framework 3.5
 * Silverlight 3.0
Example: string text = "我喜欢跑步。";
TranslateClient client = new TranslateClient(/* Enter the URL of your site here */); string translated = client.Translate(text, Language.ChineseSimplified, Language.English); Console.WriteLine(translated); // I like running.

"

最佳回答

If I understood you correctly, you need something like this. If not, please let me know.

char separator =    ;
int length = 10;
var splitted = paragraph.Split(separator);
List<string[]> arrays = new List<string[]>();
for (int i = 0; i < splitted.Length / length + 1; i++)
{
    arrays.Add(splitted.Where((x, y) => y >= i * length && y < (i + 1) * length)
        .Select( word => word + separator).ToArray());
}

foreach (var arr in arrays)
{
    foreach (var cell in arr)
    {
        Console.Write(cell);
    }
    Console.WriteLine();
}
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签