Edit the placeholder-results to your desired form of writing. Add a | after the placeholder and select you casing-pipe.

Special thanks and shoutout 📣to https://github.com/blakeembrey/change-case

plural

Converts an item to its pluralized form ("y" to "ies" or a trailing "s")

#{ "item" | plural }# => items

#{ "entity" | plural }# => entities

title

Make the first letter of the string uppercase:

#{ "foo bar baz" | title }# => Foo Bar Baz

camelCase

Return as a string with the separators denoted by having the next letter capitalized.

model.name = 'test string'#{model.name | lowercamelcase}# => "testString"
model.name = 'test string'#{model.name | lcc}# => "testString"

constantCase

Return as an upper case, underscore separated string.

model.name = 'test string'#{model.name | constant}# 
=> "TEST_STRING"
model.name = 'test string'#{model.name | constantCase}# 
=> "TEST_STRING"

dotCase

Return as a lower case, period separated string.

model.name = 'test string'#{model.name | dot}# => "test.string"

headerCase

Return as a title cased, dash separated string.

model.name = 'test string'#{model.name | header}# => "Test-String"

lowerCase

Return the string in lower case.

model.name = 'TEST STRING'#{model.name | lower}# "test string"

lowerCaseFirst

Return the string with the first character lower cased.

model.name = 'TEST'#{model.name | firstLower}# => "tEST"
model.name = 'TEST'#{model.name | fl}# => "tEST"

paramCase

Return as a lower case, dash separated string.

model.name = 'test string'#{model.name | hyphen}# => "test-string"

pascalCase

Return as a string denoted in the same fashion as camelCase, but with the first letter also capitalized.

model.name = 'test string'#{model.name | pascal}# => "TestString"

pathCase

Return as a lower case, slash separated string.

model.name = 'test string'#{model.name| path}# => "test/string"
model.name = 'test string'#{model.name| pathCase}# => "test/string"

sentenceCase

Return as a lower case, space separated string with the first letter upper case.

model.name = 'test string'#{model.name | sentence}# => "Test string"

snakeCase

Return as a lower case, underscore separated string.

model.name = 'test string'#{model.name | snake}# => "test_string"

swapCase

Return as a string with every character case reversed.

model.name = 'Test String'#{model.name | swap}# => "tEST sTRING"

titleCase

Return as a space separated string with the first character of every word upper cased.

model.name = 'a simple test'#{model.name | title}# => "A Simple Test"

upperCase

Return the string in upper case.

model.name = 'test string'#{model.name | upper}# => "TEST STRING"

upperCaseFirst

Return the string with the first character upper cased.

model.name = 'test'#{model.name | ucc}# => "Test"
model.name = 'test'#{model.name | upperCamelCase}# => "Test"

trim

Strip leading and trailing whitespace:

#{ "  foo " | trim }# => foo

truncate

Return a truncated copy of the string. The length is specified with the first parameter which defaults to 255. If the second parameter is true the filter will cut the text at length. Otherwise it will discard the last word. If the text was in fact truncated it will append an ellipsis sign ("..."). A different ellipsis sign than "(...)" can be specified using the third parameter.

Truncate to 3 characters:

#{ "foo bar" | truncate(3) }# => foo  
// or
#{ "foo bar baz" | truncate(6, true, "?") }# => foo ba ?
Did this answer your question?