Helpers/string

camelCase

camelCase(key): string

Convert (kebab-case or snake_case) to camelCase

Parameters

Name Type
key string

Returns

string

Defined in

src/core/helpers/string/camel-case.ts#14


fuzzySearchIndex

fuzzySearchIndex(needle, haystack, offset?, maxDistance?): [number, number]

Finds the position of the substring in the string, if any, and returns the length of the found subsequence.
Unlike indexOf ignores INVISIBLE_SPACE and may fail at maxDistance characters

Parameters

Name Type Default value
needle string undefined
haystack string undefined
offset number 0
maxDistance number 1

Returns

[number, number]

Defined in

src/core/helpers/string/fuzzy-search-index.ts#17


sprintf

sprintf(str, args?): string

Simple variant sprintf function

Parameters

Name Type
str string
args? (string | number)[]

Returns

string

Defined in

src/core/helpers/string/i18n.ts#24


i18n

i18n(key, params?, options?): string

Internationalization method. Uses Jodit.lang object

Parameters

Name Type
key string
params? (string | number)[]
options? ILanguageOptions

Returns

string

Example

var editor = Jodit.make("#redactor", {
     language: 'ru'
});
console.log(editor.i18n('Cancel')) //Отмена;

Jodit.defaultOptions.language = 'ru';
console.log(Jodit.prototype.i18n('Cancel')) //Отмена

Jodit.lang.cs = {
   Cancel: 'Zrušit'
};
Jodit.defaultOptions.language = 'cs';
console.log(Jodit.prototype.i18n('Cancel')) //Zrušit

Jodit.lang.cs = {
   'Hello world': 'Hello \s Good \s'
};
Jodit.defaultOptions.language = 'cs';
console.log(Jodit.prototype.i18n('Hello world', 'mr.Perkins', 'day')) //Hello mr.Perkins Good day
Defined in

src/core/helpers/string/i18n.ts#69


kebabCase

kebabCase(key): string

Parameters

Name Type
key string

Returns

string

Defined in

src/core/helpers/string/kebab-case.ts#11


CamelCaseToKebabCase

CamelCaseToKebabCase(key): string

Parameters

Name Type
key string

Returns

string

Defined in

src/core/helpers/string/kebab-case.ts#19


stringify

stringify(value, options?): string

Safe stringify circular object

Parameters

Name Type
value unknown
options Object
options.excludeKeys? string[]
options.prettify? string

Returns

string

Defined in

src/core/helpers/string/stringify.ts#16


trim

trim(value): string

It clears the line of all auxiliary invisible characters , from the spaces and line breaks , tabs
from the beginning and end of the line

Parameters

Name Type
value string

Returns

string

Defined in

src/core/helpers/string/trim.ts#22


trimChars

trimChars(value, chars): string

Parameters

Name Type
value string
chars string

Returns

string

Defined in

src/core/helpers/string/trim.ts#28


trimInv

trimInv(value): string

Trim only invisible chars

Parameters

Name Type
value string

Returns

string

Defined in

src/core/helpers/string/trim.ts#37


ucfirst

ucfirst(value): string

Make a string's first character uppercase

Parameters

Name Type
value string

Returns

string

Defined in

jodit/src/core/helpers/string/ucfirst.ts:14