c#中空格的表示方法

Tulipfly 2008-08-07 09:45:03
请问下我在C#中以下空格怎么表示啊?

int intCutChar = strCutChar.LastIndexOf(value,0);

其中的value表示空格,也就是以空格来分隔开,哪位大虾帮忙解决啊,谢谢了.
...全文
1391 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiang_jiajia10 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(" ",0); 
zpcoder 2008-08-07
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 ZengHD 的回复:]
int intCutChar = strCutChar.LastIndexOf(" ",0);
[/Quote]
sytu_hzj 2008-08-07
  • 打赏
  • 举报
回复
' ' 或者 " "就可以啦
Tulipfly 2008-08-07
  • 打赏
  • 举报
回复
可以了,是不带第二个参数,谢谢你们啊....
mators 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.Split(' ').Length;
paulin 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(' ');
也没有问题。
奇怪我这里的LastIndexof(string,int32)和LastIndexof(char,int32)带int32参数的也不好用啊...
楼主不带int32参数的也不好使吗?
Tulipfly 2008-08-07
  • 打赏
  • 举报
回复
以上的方式我都试验过了的啊,不行啊,还有没有别的方法呢?
lovehongyun 2008-08-07
  • 打赏
  • 举报
回复
" "
paulin 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(" ");
guyan033 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(" ",0);
fengfeng1985 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(" ",0);
mailto520 2008-08-07
  • 打赏
  • 举报
回复
" " or  
西安风影 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(" ",0);
zhpfeiqq 2008-08-07
  • 打赏
  • 举报
回复
" "
TonyWu66 2008-08-07
  • 打赏
  • 举报
回复
可以使用Split
返回包含此实例中的子字符串(由指定 Char 或 String 数组的元素分隔)的 String 数组。
class TestStringSplit
{
static void Main()
{
char[] delimiterChars = { ' ', ',', '.', ':', '\t' };

string text = "one\ttwo three:four,five six seven";
System.Console.WriteLine("Original text: '{0}'", text);

string[] words = text.Split(delimiterChars);
System.Console.WriteLine("{0} words in text:", words.Length);

foreach (string s in words)
{
System.Console.WriteLine(s);
}
}
}
Fioit 2008-08-07
  • 打赏
  • 举报
回复
' '
单引号中间一个空格
yangpeiyu 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(" ",0);
ZengHD 2008-08-07
  • 打赏
  • 举报
回复
int intCutChar = strCutChar.LastIndexOf(" ",0);

wfcfan 2008-08-07
  • 打赏
  • 举报
回复
\n

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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