去字符串首位的问题

南瓜饼 2011-01-25 06:40:28
有一个字符串 abc
有没有一个方法 只得到 a的方法
...全文
50 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2011-01-25
  • 打赏
  • 举报
回复
Substring(0,1)
ToCharArray()[0]
叶子 2011-01-25
  • 打赏
  • 举报
回复
字符串.Substring(起始位置,截取长度)
旅行者I号 2011-01-25
  • 打赏
  • 举报
回复
string str = "wo";
char cFirst=str[0];
sunrui521 2011-01-25
  • 打赏
  • 举报
回复

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{
string a = "abcd";
Console.Write( a.Substring(0, 1));
Console.ReadKey();
}
}
}

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧