sql left function equivalent in c#
  • how can i use left function in c# like in sql we use left("001-002",3) so it will return 001.
  • 3 Comments sorted by
  • Vote Up0Vote Down Jaguar777Jaguar777
    51.00 Karma Accepted Answer
    //Please create a static class like this

            public static class StringExtensions
            {
                public static string Left(this string s, int left)
                {
                    return s.Substring(0, left);
                }
            }

            //You can use it like this:

            string left = s.Left(number);
  • thanks @jaguar777
  • you are welcome

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

    Optimum Creative