home
  • Blog
  • Home
  • Projects
    • Ember
    • EmberData
    • Ember CLI
3.28
  • Packages
    • @ember/application
    • @ember/array
    • @ember/canary-features
    • @ember/component
    • @ember/component/template-only
    • @ember/controller
    • @ember/debug
    • @ember/destroyable
    • @ember/engine
    • @ember/error
    • @ember/helper
    • @ember/object
    • @ember/polyfills
    • @ember/routing
    • @ember/runloop
    • @ember/service
    • @ember/string
    • @ember/template
    • @ember/test
    • @ember/utils
    • @glimmer/component
    • @glimmer/tracking
    • @glimmer/tracking/primitives/cache
    • rsvp
  • Classes
    • Application
    • ApplicationInstance
    • ApplicationInstance.BootOptions
    • ArrayProxy
    • Checkbox
    • Component
    • ComputedProperty
    • ContainerDebugAdapter
    • Controller
    • CoreObject
    • DataAdapter
    • Ember.EmberENV
    • Ember.Error
    • Ember.Namespace
    • Ember.NativeArray
    • Ember.Templates.helpers
    • Ember.Test
    • Ember.Test.QUnitAdapter
    • EmberArray
    • EmberObject
    • EmberRouter
    • Engine
    • EngineInstance
    • EventTarget
    • Evented
    • HashLocation
    • Helper
    • HistoryLocation
    • LinkComponent
    • Mixin
    • MutableArray
    • NoneLocation
    • ObjectProxy
    • Observable
    • Promise
    • PromiseProxyMixin
    • Route
    • RouteInfo
    • RouteInfoWithAttributes
    • RouterService
    • Service
    • String
    • TestAdapter
    • TextArea
    • TextField
    • Transition

Class String public


Defined in: packages/@ember/string/index.ts:75
Module: @ember/string

Defines string helper methods including string formatting and localization. Unless EmberENV.EXTEND_PROTOTYPES.String is false these methods will also be added to the String.prototype as well.


Methods

camelize (str) : String public

Module: @ember/string

Defined in packages/@ember/string/index.ts:213

str
String

The string to camelize.

returns
String

the camelized string.

Returns the lowerCamelCase form of a string.

import { camelize } from '@ember/string';

camelize('innerHTML');                   // 'innerHTML'
camelize('action_name');                 // 'actionName'
camelize('css-class-name');              // 'cssClassName'
camelize('my favorite items');           // 'myFavoriteItems'
camelize('My Favorite Items');           // 'myFavoriteItems'
camelize('private-docs/owner-invoice');  // 'privateDocs/ownerInvoice'

capitalize (str) : String public

Module: @ember/string

Defined in packages/@ember/string/index.ts:281

str
String

The string to capitalize.

returns
String

The capitalized string.

Returns the Capitalized form of a string

import { capitalize } from '@ember/string';

capitalize('innerHTML')                 // 'InnerHTML'
capitalize('action_name')               // 'Action_name'
capitalize('css-class-name')            // 'Css-class-name'
capitalize('my favorite items')         // 'My favorite items'
capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'

classify (str) : String public

Module: @ember/string

Defined in packages/@ember/string/index.ts:236

str
String

the string to classify

returns
String

the classified string

Returns the UpperCamelCase form of a string.

import { classify } from '@ember/string';

classify('innerHTML');                   // 'InnerHTML'
classify('action_name');                 // 'ActionName'
classify('css-class-name');              // 'CssClassName'
classify('my favorite items');           // 'MyFavoriteItems'
classify('private-docs/owner-invoice');  // 'PrivateDocs/OwnerInvoice'

dasherize (str) : String public

Module: @ember/string

Defined in packages/@ember/string/index.ts:191

str
String

The string to dasherize.

returns
String

the dasherized string.

Replaces underscores, spaces, or camelCase with dashes.

import { dasherize } from '@ember/string';

dasherize('innerHTML');                // 'inner-html'
dasherize('action_name');              // 'action-name'
dasherize('css-class-name');           // 'css-class-name'
dasherize('my favorite items');        // 'my-favorite-items'
dasherize('privateDocs/ownerInvoice';  // 'private-docs/owner-invoice'

decamelize (str) : String public

Module: @ember/string

Defined in packages/@ember/string/index.ts:170

str
String

The string to decamelize.

returns
String

the decamelized string.

Converts a camelized string into all lower case separated by underscores.

import { decamelize } from '@ember/string';

decamelize('innerHTML');          // 'inner_html'
decamelize('action_name');        // 'action_name'
decamelize('css-class-name');     // 'css-class-name'
decamelize('my favorite items');  // 'my favorite items'

underscore (str) : String public

Module: @ember/string

Defined in packages/@ember/string/index.ts:258

str
String

The string to underscore.

returns
String

the underscored string.

More general than decamelize. Returns the lower_case_and_underscored form of a string.

import { underscore } from '@ember/string';

underscore('innerHTML');                 // 'inner_html'
underscore('action_name');               // 'action_name'
underscore('css-class-name');            // 'css_class_name'
underscore('my favorite items');         // 'my_favorite_items'
underscore('privateDocs/ownerInvoice');  // 'private_docs/owner_invoice'

w (str) : Array public

Module: @ember/string

Defined in packages/@ember/string/index.ts:144

str
String

The string to split

returns
Array

array containing the split strings

Splits a string into separate units separated by spaces, eliminating any empty strings in the process. This is a convenience method for split that is mostly useful when applied to the String.prototype.

import { w } from '@ember/string';

w("alpha beta gamma").forEach(function(key) {
  console.log(key);
});

// > alpha
// > beta
// > gamma
On this page


Methods

  • camelize
  • capitalize
  • classify
  • dasherize
  • decamelize
  • underscore
  • w
Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2025 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue Created with Sketch.