Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference Dasherize and Hyphenate #574

Closed
fleed opened this issue Jul 15, 2016 · 2 comments
Closed

Difference Dasherize and Hyphenate #574

fleed opened this issue Jul 15, 2016 · 2 comments

Comments

@fleed
Copy link

fleed commented Jul 15, 2016

Is there a difference between Dasherize and Hyphenate?

If not, how can I convert a string like "ThisIsMyString" to "this-is-my-string"? Should I do something like this

"ThisIsMyString".Underscore().Hyphenate()

?

@klaus78
Copy link

klaus78 commented Feb 6, 2017

See also #42

@aloisdg
Copy link
Contributor

aloisdg commented Feb 6, 2017

Is there a difference between Dasherize and Hyphenate?

From @klaus78 's issue :

Hyphenate instead of Dasherize makes more sense.
We cannot remove Dasherize but we could add Hyphenate method that calls Dasherize.

Also the code explains it better:

        /// <summary>
        /// Replaces underscores with dashes in the string
        /// </summary>
        /// <param name="underscoredWord"></param>
        /// <returns></returns>
        public static string Dasherize(this string underscoredWord)
        {
            return underscoredWord.Replace('_', '-');
        }
		
        /// <summary>
        /// Replaces underscores with hyphens in the string
        /// </summary>
        /// <param name="underscoredWord"></param>
        /// <returns></returns>
        public static string Hyphenate(this string underscoredWord)
        {
            return Dasherize(underscoredWord);
        }

source

@aloisdg aloisdg closed this as completed Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants