Skip to content

Text Humanize

Vali (naser) Rafinia edited this page Mar 27, 2023 · 2 revisions

The nhash text humanize command provides various options to convert a given text into different humanized forms such as Pascal-case, Camel-case, Kebab-case, Underscore, lowercase, etc.

Usage

nhash text humanize <type> <text> [options]

The command takes two mandatory arguments: <type> and <text>. The <type> argument specifies the type of humanization that you want to apply to the given <text>. The following are the available humanization options:

  • camel: Convert the text into camelCase.
  • dehumanize: Convert the text from humanized format to a normal string.
  • humanize: Convert the text into a humanized form.
  • hyphenate: Convert the text into a kebab case.
  • kebab: Convert the text into kebab-case.
  • lowercase: Convert the text into lowercase.
  • pascal: Convert the text into PascalCase.
  • underscore: Convert the text into snake_case.
  • uppercase: Convert the text into UPPERCASE.

Options

  • -o, --output <output>: File name for writing the output.
  • -?, -h, --help: Show help and usage information.

Arguments

  • <text>: The <text> argument specifies the text to be humanized.

Examples

  1. Convert text to CamelCase:
nhash text humanize camel "this is a text"

Output:

thisIsAText
  1. Convert text to kebab-case:
nhash text humanize kebab "This is a Text"

Output:

this-is-a-text
  1. Convert text to snake_case:
nhash text humanize underscore "This is a Text"

Output:

this_is_a_text
  1. Convert text to PascalCase:
nhash text humanize pascal "This is a Text"

Output:

ThisIsAText
  1. Convert text to lowercase:
nhash text humanize lowercase "This is a Text"

Output:

this is a text
  1. Convert text to UPPERCASE:
nhash text humanize uppercase "This is a Text"

Output:

THIS IS A TEXT
  1. Convert a humanized text to a normal string:
nhash text humanize dehumanize "ThisIsAText"

Output:

this is a text
  1. Write output to a file:
nhash text humanize camel "this is a text" --output output.txt

The above command will write the output to a file named output.txt.

Clone this wiki locally