using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PracticeReview
{
class Program
{
static void Main(string[] args)
{
#region 编写函数,实现类似.net中Trim()函数功能:去掉字符串两端的空格,例如将字符串" hello world,你 好 世界 ! "两端空格去掉,并且将其中的所有其他空格都替换成一个空格,输出结果为:"hello world,你 好 世界 !"
string str = " hello world,你 好 世界 ! ";
Trim()方法直接去掉字符串两边空格
//str = str.Trim();
//Console.WriteLine("====" + str + "===");
string testStr = TestTrim(str);
Console.WriteLine("====" + testStr + "
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PracticeReview
{
class Program
{
static void Main(string[] args)
{
#region 编写函数,实现类似.net中Trim()函数功能:去掉字符串两端的空格,例如将字符串" hello world,你 好 世界 ! "两端空格去掉,并且将其中的所有其他空格都替换成一个空格,输出结果为:"hello world,你 好 世界 !"
string str = " hello world,你 好 世界 ! ";
Trim()方法直接去掉字符串两边空格
//str = str.Trim();
//Console.WriteLine("====" + str + "===");
string testStr = TestTrim(str);
Console.WriteLine("====" + testStr + "