C#上的字符串索引! [英] String index on C#!?

查看:534
本文介绍了C#上的字符串索引!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!



我想使用带索引字符串的数组对其进行翻译。像这样:



Hello!

I wanna do a translater on thats using an array with index a string. Like this:

string[] Words = new string[10];
//How can I do this:
Words["Hello"] = "Zdrasti";//Zdrasti a Bulgrian word





但我不知道怎么做!(如果可能的话)。我查看文章 - 没有这样的东西!



请帮助我。



But I do not know how!(If it is possible). I looked the articles - There was nothing like this!

Pls if it is help me.

推荐答案

嘿拉多斯拉夫,

你期望自己成为一项重大任务的解决方案。 .NET首先不知道Bulgrian。所以只需使用字符串连接就可以实现组合逻辑或者不可能。



您可以为Bulgrian构建自己的字典或使用第三方工具(试用Google语言)这样做。
Hey Radoslav,
The solution you expecting itself a big task. .NET doesn''t know Bulgrian first of all. So the combination logic or what so ever is not possible by just using string concatenation.

You can build your own dictionary for Bulgrian or use third party tools (Try Google Language tools) which does that.


你不能使用数组,因为一个vanilla数组只有数字索引。



但你可以用词典来做:

You can''t do it using an array, because a vanilla array has only numeric indexes.

But you can do it with a Dictionary:
Dictionary<string, string> Words = new Dictionary<string, string>();
Words["hello"] = "Zdrasti";


这篇关于C#上的字符串索引!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆