比如把一个字符串中的每一个字符都变成他后面三个的字符。比如‘A’变成‘D’,‘H’变成‘K’~~在C#里是用Uuicode字符,不能直接象C中一样直接加一个整形数字的,是吧。我是一个新手,希望高人指教啊。
解决方案 »
- Discuz!NT后台验证码不显示 字体Georgia不支持样式Regular
- DOM是动态更新的吗?
- 面试题大全?
- 有关OWC11的axchartspace的数据区域设置的问题
- 利用C#编程实现对远程服务器进程管理
- stireport 报表中的表怎么没法改变。stimulsoft报表问题
- 一个比较弱的问题,来看一下吧
- 我又有问题了!datagrid \dropdownlist\
- 想学c#,可不知道如何下手,请各位出出点子,大家刚开始是怎么学的?
- 有人能给出windows datagrid的详细用法吗?
- ComboBox的问题, 怎么遍访比对ComboBox的值呢?
- 我没有任何编程基础,想学习c#,各位能给点适合我的学习方法吗,感激不尽!
MessageBox.Show(Convert.ToString((char)x));
1.把给定字母转换出它的assic码然后加3,然后再转回来。
2.写一个方法,不过基本上写死的,如
public string ConvertToAssic(string str)
{
switch (str)
{
case "A":
str="D";
break;
case "B":
str="E";
break;
//.........
}
return str;
}
这是我按 cnhgj(戏子) (谁能告诉我Jeode怎么支持中文?)的方法写的,有什么问题么?using System;
using System.Windows.Forms;namespace ConsoleApplication2
{
class Welcome
{
static void Main()
{
Console.WriteLine("Please enter your String:");
string str = Console.ReadLine();
char[] st = new char[str.Length];
for( int i=0; i < str.Length-1; i++)
{
int x = 0; if( i == 0 )
st[i] = str[str.Length-1]; x = ((int)str[i]) + 3;
st[i+1] = MessageBox.Show( Convert.ToString( (char)x ) );
} Console.Write("The result is:");
for( int i=0; i < str.Length; i++)
Console.Write("{0}", st[i]);
Console.Write("\n");
}
}
}这是错误报告。D:\Program Files\Microsoft Visual Studio .NET 2003\Visual Studio Projects\ConsoleApplication2\Class1.cs(22): 无法将类型“System.Windows.Forms.DialogResult”隐式转换为“char”
这是代码。嘿嘿。不好意思,我是新手,水平太低,见笑了。结帐啦~using System;
using System.Windows.Forms;namespace ConsoleApplication2
{
class Welcome
{
static void Main()
{
Console.WriteLine("Please enter your String:");
string str = Console.ReadLine();
char[] st = new char[str.Length];
for( int i=0; i < str.Length-1; i++)
{
int x = 0; if( i == 0 )
st[i] = str[str.Length-1]; x = ((int)str[i]) + 3;
st[i+1] = ( (char)x );
} Console.Write("The result is:");
for( int i=0; i < str.Length; i++)
Console.Write("{0}", st[i]);
Console.Write("\n");
}
}
}