在以下示例中,
/*----------------------// kvkbl jk//bv klb /* /*gkljbgflkjbncviogf*/
如何获取/*
和*/
之间的字符串?
答案 0 :(得分:1)
看看这个tutorial
using System;
class Program
{
static void Main()
{
string s = "/*there*/ is a cat";
string s = "User name (sales)";
int start = s.IndexOf("/*");
int end = s.IndexOf(")*/")
string result = s.substring(start, end - start -1)
//result contains "there"
}
}
答案 1 :(得分:-1)
string s = "there is a cat";
//
// Split string on spaces.
// ... This will separate all the words.
//
string[] words = s.Split(' ');
foreach (string word in words)
{
Console.WriteLine(word);
}
//Output
there
is
a
cat