开发者

Remove White Space Characters From String

开发者 https://www.devze.com 2023-03-14 20:10 出处:网络
String variable stores value as like.. careteam order 4-26-11.csv i need to trim the value .. in c# as 开发者_开发技巧likecareteamorder4-26-11.csv- by removing the space ..!

String variable stores value as like .. careteam order 4-26-11.csv

i need to trim the value .. in c# as 开发者_开发技巧like careteamorder4-26-11.csv - by removing the space ..!

how to remove empty space in the string variable ?


string trimmed = "careteam order4-26-11.csv".Replace(" ", string.Empty);


    public string RemoveSpaceAfter(string inputString)
    {
        try
        {


            string[] Split = inputString.Split(new Char[] { ' ' });
            //SHOW RESULT
            for (int i = 0; i < Split.Length; i++)
            {
                fateh += Convert.ToString(Split[i]);
            }
            return fateh;
        }
        catch (Exception gg)
        {
            return fateh;
        }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消