npm install @monstermann/stringpnpm add @monstermann/stringyarn add @monstermann/stringbun add @monstermann/stringnpm install -D @monstermann/unplugin-stringpnpm -D add @monstermann/unplugin-stringyarn -D add @monstermann/unplugin-stringbun -D add @monstermann/unplugin-string// vite.config.tsimportstringfrom"@monstermann/unplugin-string/vite";exportdefaultdefineConfig({plugins: [string()],});// rollup.config.jsimportstringfrom"@monstermann/unplugin-string/rollup";exportdefault{plugins: [string()],};// rolldown.config.jsimportstringfrom"@monstermann/unplugin-string/rolldown";exportdefault{plugins: [string()],};// webpack.config.jsconststring=require("@monstermann/unplugin-string/webpack");module.exports={plugins: [string()],};// rspack.config.jsconststring=require("@monstermann/unplugin-string/rspack");module.exports={plugins: [string()],};// esbuild.config.jsimport{build}from"esbuild";importstringfrom"@monstermann/unplugin-string/esbuild";build({plugins: [string()],});functionString.append(target: string,source: Iterable<string>,): stringAppends source or strings from source iterable to the end of target string.
import{String}from"@monstermann/string";String.append("hello"," world");// "hello world"String.append("hello",[" ","world"]);// "hello world"import{String}from"@monstermann/string";pipe("hello",String.append(" world"));// "hello world"pipe("hello",String.append([" ","world"]));// "hello world"functionString.camelCase<Textendsstring>(target: T,): CamelCase<T>Converts target string to camelCase format.
import{String}from"@monstermann/string";String.camelCase("hello world");// "helloWorld"String.camelCase("hello-world");// "helloWorld"import{String}from"@monstermann/string";pipe("hello world",String.camelCase());// "helloWorld"pipe("hello-world",String.camelCase());// "helloWorld"functionString.capitalize<Textendsstring>(target: T,): Capitalize<T>Capitalizes the first letter of target string.
import{String}from"@monstermann/string";String.capitalize("hello world");// "Hello world"String.capitalize("hello");// "Hello"import{String}from"@monstermann/string";pipe("hello world",String.capitalize());// "Hello world"pipe("hello",String.capitalize());// "Hello"functionString.constantCase<Textendsstring>(target: T,): ConstantCase<T>Converts target string to CONSTANT_CASE format.
import{String}from"@monstermann/string";String.constantCase("hello world");// "HELLO_WORLD"String.constantCase("helloWorld");// "HELLO_WORLD"import{String}from"@monstermann/string";pipe("hello world",String.constantCase());// "HELLO_WORLD"pipe("helloWorld",String.constantCase());// "HELLO_WORLD"functionString.create(value?: any): stringAn alias for String(target).
import{String}from"@monstermann/string";String.create(10);// "10"functionString.deburr(target: string): stringRemoves diacritical marks from target string and converts special characters to their ASCII equivalents.
The function normalizes the string, strips combining diacritical marks, and replaces special characters like ligatures (Æ, œ) and extended Latin characters (ø, ß, þ) with their closest ASCII representations.
import{String}from"@monstermann/string";String.deburr("café");// "cafe"String.deburr("naïve résumé");// "naive resume"String.deburr("Æsop's Œuvres");// "Aesop's Oeuvres"String.deburr("Ørsted");// "Orsted"import{String}from"@monstermann/string";pipe("café",String.deburr());// "cafe"pipe("naïve résumé",String.deburr());// "naive resume"pipe("Æsop's Œuvres",String.deburr());// "Aesop's Oeuvres"pipe("Ørsted",String.deburr());// "Orsted"functionString.drop(target: string,amount: number): stringRemoves the first amount characters from target string.
import{String}from"@monstermann/string";String.drop("hello world",6);// "world"import{String}from"@monstermann/string";pipe("hello world",String.drop(6));// "world"functionString.dropLast(target: string,amount: number): stringRemoves the last amount characters from target string.
import{String}from"@monstermann/string";String.dropLast("hello world",6);// "hello"import{String}from"@monstermann/string";pipe("hello world",String.dropLast(6));// "hello"functionString.endsWith(target: string,source: string): booleanChecks if target string ends with source string.
import{String}from"@monstermann/string";String.endsWith("hello world","world");// trueimport{String}from"@monstermann/string";pipe("hello world",String.endsWith("world"));// truefunctionString.graphemes(target: string): Generator<string>Returns a generator that yields individual grapheme clusters from target string.
A grapheme cluster represents a single user-perceived character, which may consist of multiple Unicode code points (e.g., emojis with modifiers, base characters with combining diacriticals).
import{String}from"@monstermann/string";[...String.graphemes("hello")];// ["h", "e", "l", "l", "o"][...String.graphemes("👨👩👧👦")];// ["👨👩👧👦"][...String.graphemes("café")];// ["c", "a", "f", "é"][...String.graphemes("👋🏽")];// ["👋🏽"]// Using in a loopfor(constgraphemeofString.graphemes("hello👋")){console.log(grapheme);// "h", "e", "l", "l", "o", "👋"}import{String}from"@monstermann/string";[...pipe("hello",String.graphemes())];// ["h", "e", "l", "l", "o"][...pipe("👨👩👧👦",String.graphemes())];// ["👨👩👧👦"][...pipe("café",String.graphemes())];// ["c", "a", "f", "é"][...pipe("👋🏽",String.graphemes())];// ["👋🏽"]// Using in a loopfor(constgraphemeofpipe("hello👋",String.graphemes())){console.log(grapheme);// "h", "e", "l", "l", "o", "👋"}functionString.has(target: string,source: string): booleanChecks if target string contains source string.
import{String}from"@monstermann/string";String.has("hello world","world");// trueimport{String}from"@monstermann/string";pipe("hello world",String.has("world"));// truefunctionString.hasAll(target: string,source: Iterable<string>,): booleanChecks if target string contains all strings from the source iterable.
import{String}from"@monstermann/string";String.hasAll("hello world",["hello","world"]);// trueimport{String}from"@monstermann/string";pipe("hello world",String.hasAll(["hello","world"]));// truefunctionString.hasAny(target: string,source: Iterable<string>,): booleanChecks if target string contains any of the strings from the source iterable.
import{String}from"@monstermann/string";String.hasAny("hello world",["foo","world"]);// trueimport{String}from"@monstermann/string";pipe("hello world",String.hasAny(["foo","world"]));// truefunctionString.hasNone(target: string,source: Iterable<string>,): booleanChecks if target string contains none of the strings from the source iterable.
import{String}from"@monstermann/string";String.hasNone("hello world",["foo","bar"]);// trueimport{String}from"@monstermann/string";pipe("hello world",String.hasNone(["foo","bar"]));// truefunctionString.indexOf(target: string,source: string): numberReturns the index of the first occurrence of source string in target string, or -1 if not found.
import{String}from"@monstermann/string";String.indexOf("hello world","world");// 6import{String}from"@monstermann/string";pipe("hello world",String.indexOf("world"));// 6functionString.indexOfOr<T>(target: string,source: string,or: T,): number|TReturns the index of the first occurrence of source string in target string, or the or value if not found.
import{String}from"@monstermann/string";String.indexOfOr("hello world","world",-1);// 6String.indexOfOr("hello world","foo",-1);// -1import{String}from"@monstermann/string";pipe("hello world",String.indexOfOr("world",-1));// 6pipe("hello world",String.indexOfOr("foo",-1));// -1functionString.indexOfOrElse<T>(target: string,source: string,orElse: (target: string)=>T,): number|TReturns the index of the first occurrence of source string in target string, or the result of calling orElse function with target if not found.
import{String}from"@monstermann/string";String.indexOfOrElse("hello world","world",()=>-1);// 6String.indexOfOrElse("hello world","foo",(str)=>str.length);// 11import{String}from"@monstermann/string";pipe("hello world",String.indexOfOrElse("world",()=>-1),);// 6pipe("hello world",String.indexOfOrElse("foo",(str)=>str.length),);// 11functionString.indexOfOrThrow(target: string,source: string,): numberReturns the index of the first occurrence of source string in target string, or throws an error if not found.
import{String}from"@monstermann/string";String.indexOfOrThrow("hello world","world");// 6String.indexOfOrThrow("hello world","foo");// throws FnErrorimport{String}from"@monstermann/string";pipe("hello world",String.indexOfOrThrow("world"));// 6pipe("hello world",String.indexOfOrThrow("foo"));// throws FnErrorfunctionString.is(target: unknown): target is stringChecks if target is a string.
import{String}from"@monstermann/string";String.is("hello");// trueString.is(123);// falseString.is(null);// falseimport{String}from"@monstermann/string";pipe("hello",String.is());// truepipe(123,String.is());// falsepipe(null,String.is());// falsefunctionString.isASCII(target: string): booleanChecks if target string contains only ASCII characters (U+0000 to U+007F).
Returns true if all characters in the string are within the ASCII range, false otherwise.
import{String}from"@monstermann/string";String.isASCII("hello world");// trueString.isASCII("café");// falseString.isASCII("123!@#");// trueString.isASCII("hello 🌍");// falseimport{String}from"@monstermann/string";pipe("hello world",String.isASCII());// truepipe("café",String.isASCII());// falsepipe("123!@#",String.isASCII());// truepipe("hello 🌍",String.isASCII());// falsefunctionString.isEmpty(target: string): booleanChecks if target string is empty.
import{String}from"@monstermann/string";String.isEmpty("");// trueString.isEmpty("hello");// falseimport{String}from"@monstermann/string";pipe("",String.isEmpty());// truepipe("hello",String.isEmpty());// falsefunctionString.kebabCase<Textendsstring>(target: T,): KebabCase<T>Converts target string to kebab-case format.
import{String}from"@monstermann/string";String.kebabCase("hello world");// "hello-world"String.kebabCase("helloWorld");// "hello-world"import{String}from"@monstermann/string";pipe("hello world",String.kebabCase());// "hello-world"pipe("helloWorld",String.kebabCase());// "hello-world"functionString.lastIndexOf(target: string,source: string): numberReturns the index of the last occurrence of source string in target string, or -1 if not found.
import{String}from"@monstermann/string";String.lastIndexOf("hello world hello","hello");// 12import{String}from"@monstermann/string";pipe("hello world hello",String.lastIndexOf("hello"));// 12functionString.lastIndexOfOr<T>(target: string,source: string,or: T,): number|TReturns the index of the last occurrence of source string in target string, or the or value if not found.
import{String}from"@monstermann/string";String.lastIndexOfOr("hello world hello","hello",-1);// 12String.lastIndexOfOr("hello world","foo",-1);// -1import{String}from"@monstermann/string";pipe("hello world hello",String.lastIndexOfOr("hello",-1));// 12pipe("hello world",String.lastIndexOfOr("foo",-1));// -1functionString.lastIndexOfOrElse<T>(target: string,source: string,orElse: (target: string)=>T,): number|TReturns the index of the last occurrence of source string in target string, or the result of calling orElse function with target if not found.
import{String}from"@monstermann/string";String.lastIndexOfOrElse("hello world hello","hello",()=>-1);// 12String.lastIndexOfOrElse("hello world","foo",(str)=>str.length);// 11import{String}from"@monstermann/string";pipe("hello world hello",String.lastIndexOfOrElse("hello",()=>-1),);// 12pipe("hello world",String.lastIndexOfOrElse("foo",(str)=>str.length),);// 11functionString.lastIndexOfOrThrow(target: string,source: string,): numberReturns the index of the last occurrence of source string in target string, or throws an error if not found.
import{String}from"@monstermann/string";String.lastIndexOfOrThrow("hello world hello","hello");// 12String.lastIndexOfOrThrow("hello world","foo");// throws FnErrorimport{String}from"@monstermann/string";pipe("hello world hello",String.lastIndexOfOrThrow("hello"));// 12pipe("hello world",String.lastIndexOfOrThrow("foo"));// throws FnErrorfunctionString.length(target: string): numberReturns the length of target string.
import{String}from"@monstermann/string";String.length("hello world");// 11import{String}from"@monstermann/string";pipe("hello world",String.length());// 11functionString.lowerCase<Textendsstring>(target: T,): Lowercase<T>Converts target string to lowercase.
import{String}from"@monstermann/string";String.lowerCase("HELLO WORLD");// "hello world"String.lowerCase("Hello World");// "hello world"import{String}from"@monstermann/string";pipe("HELLO WORLD",String.lowerCase());// "hello world"pipe("Hello World",String.lowerCase());// "hello world"functionString.match(target: string,source: string|RegExp,): RegExpMatchArray|nullReturns the result of matching target string against source string or regular expression, or null if no match is found.
import{String}from"@monstermann/string";String.match("hello world","world");// ["world", index: 6, input: "hello world", groups: undefined]String.match("hello world",/\d+/);// nullimport{String}from"@monstermann/string";pipe("hello world",String.match("world"));// ["world", index: 6, input: "hello world", groups: undefined]pipe("hello world",String.match(/\d+/));// nullfunctionString.matchOr<T>(target: string,source: string|RegExp,or: T,): RegExpMatchArray|TReturns the result of matching target string against source string or regular expression, or the or value if no match is found.
import{String}from"@monstermann/string";String.matchOr("hello world","world",[]);// ["world", index: 6, input: "hello world", groups: undefined]String.matchOr("hello world",/\d+/,[]);// []import{String}from"@monstermann/string";pipe("hello world",String.matchOr("world",[]));// ["world", index: 6, input: "hello world", groups: undefined]pipe("hello world",String.matchOr(/\d+/,[]));// []functionString.matchOrElse<T>(target: string,source: string|RegExp,orElse: (target: string)=>T,): RegExpMatchArray|TReturns the result of matching target string against source string or regular expression, or the result of calling orElse function with target if no match is found.
import{String}from"@monstermann/string";String.matchOrElse("hello world","world",()=>[]);// ["world", index: 6, input: "hello world", groups: undefined]String.matchOrElse("hello world",/\d+/,(str)=>[str]);// ["hello world"]import{String}from"@monstermann/string";pipe("hello world",String.matchOrElse("world",()=>[]),);// ["world", index: 6, input: "hello world", groups: undefined]pipe("hello world",String.matchOrElse(/\d+/,(str)=>[str]),);// ["hello world"]functionString.matchOrThrow(target: string,source: string|RegExp,): RegExpMatchArrayReturns the result of matching target string against source string or regular expression, or throws an error if no match is found.
import{String}from"@monstermann/string";String.matchOrThrow("hello world","world");// ["world", index: 6, input: "hello world", groups: undefined]String.matchOrThrow("hello world",/\d+/);// throws FnErrorimport{String}from"@monstermann/string";pipe("hello world",String.matchOrThrow("world"));// ["world", index: 6, input: "hello world", groups: undefined]pipe("hello world",String.matchOrThrow(/\d+/));// throws FnErrorfunctionString.padEnd(target: string,length: number,fill: string,): stringPads target string from the end with fill string until the result reaches the specified length.
import{String}from"@monstermann/string";String.padEnd("hello",10," ");// "hello "import{String}from"@monstermann/string";pipe("hello",String.padEnd(10," "));// "hello "functionString.padStart(target: string,length: number,fill: string,): stringPads target string from the start with fill string until the result reaches the specified length.
import{String}from"@monstermann/string";String.padStart("hello",10," ");// " hello"import{String}from"@monstermann/string";pipe("hello",String.padStart(10," "));// " hello"functionString.parseFloat(target: string): numberParses target string and returns a floating point number.
import{String}from"@monstermann/string";String.parseFloat("3.14");// 3.14String.parseFloat("42.5abc");// 42.5import{String}from"@monstermann/string";pipe("3.14",String.parseFloat());// 3.14pipe("42.5abc",String.parseFloat());// 42.5functionString.parseFloatOr<T>(target: string,or: T): number|TParses target string and returns a floating point number, or the or value if parsing fails.
import{String}from"@monstermann/string";String.parseFloatOr("3.14",0);// 3.14String.parseFloatOr("abc",0);// 0import{String}from"@monstermann/string";pipe("3.14",String.parseFloatOr(0));// 3.14pipe("abc",String.parseFloatOr(0));// 0functionString.parseFloatOrElse<T>(target: string,orElse: (target: string)=>T,): number|TParses target string and returns a floating point number, or the result of calling orElse function with target if parsing fails.
import{String}from"@monstermann/string";String.parseFloatOrElse("3.14",()=>0);// 3.14String.parseFloatOrElse("abc",(str)=>str.length);// 3import{String}from"@monstermann/string";pipe("3.14",String.parseFloatOrElse(()=>0),);// 3.14pipe("abc",String.parseFloatOrElse((str)=>str.length),);// 3functionString.parseFloatOrThrow(target: string): numberParses target string and returns a floating point number, or throws an error if parsing fails.
import{String}from"@monstermann/string";String.parseFloatOrThrow("3.14");// 3.14String.parseFloatOrThrow("abc");// throws FnErrorimport{String}from"@monstermann/string";pipe("3.14",String.parseFloatOrThrow());// 3.14pipe("abc",String.parseFloatOrThrow());// throws FnErrorfunctionString.parseInt(target: string): numberParses target string and returns an integer.
import{String}from"@monstermann/string";String.parseInt("42");// 42String.parseInt("42.5");// 42import{String}from"@monstermann/string";pipe("42",String.parseInt());// 42pipe("42.5",String.parseInt());// 42functionString.parseIntOr<T>(target: string,or: T): number|TParses target string and returns an integer, or the or value if parsing fails.
import{String}from"@monstermann/string";String.parseIntOr("42",0);// 42String.parseIntOr("abc",0);// 0import{String}from"@monstermann/string";pipe("42",String.parseIntOr(0));// 42pipe("abc",String.parseIntOr(0));// 0functionString.parseIntOrElse<T>(target: string,orElse: (target: string)=>T,): number|TParses target string and returns an integer, or the result of calling orElse function with target if parsing fails.
import{String}from"@monstermann/string";String.parseIntOrElse("42",()=>0);// 42String.parseIntOrElse("abc",(str)=>str.length);// 3import{String}from"@monstermann/string";pipe("42",String.parseIntOrElse(()=>0),);// 42pipe("abc",String.parseIntOrElse((str)=>str.length),);// 3functionString.parseIntOrThrow(target: string): numberParses target string and returns an integer, or throws an error if parsing fails.
import{String}from"@monstermann/string";String.parseIntOrThrow("42");// 42String.parseIntOrThrow("abc");// throws FnErrorimport{String}from"@monstermann/string";pipe("42",String.parseIntOrThrow());// 42pipe("abc",String.parseIntOrThrow());// throws FnErrorfunctionString.pascalCase<Textendsstring>(target: T,): PascalCase<T>Converts target string to PascalCase format.
import{String}from"@monstermann/string";String.pascalCase("hello world");// "HelloWorld"String.pascalCase("hello-world");// "HelloWorld"import{String}from"@monstermann/string";pipe("hello world",String.pascalCase());// "HelloWorld"pipe("hello-world",String.pascalCase());// "HelloWorld"functionString.prepend(target: string,source: Iterable<string>,): stringPrepends string or strings from source iterable to the beginning of target string.
import{String}from"@monstermann/string";String.prepend("world","hello ");// "hello world"String.prepend("world",["hello"," "]);// "hello world"import{String}from"@monstermann/string";pipe("world",String.prepend("hello "));// "hello world"pipe("world",String.prepend(["hello"," "]));// "hello world"functionString.repeat<Textendsstring,Uextendsnumber>(target: T,amount: U,): Repeat<T,U>Repeats target string amount times.
import{String}from"@monstermann/string";String.repeat("hello",3);// "hellohellohello"import{String}from"@monstermann/string";pipe("hello",String.repeat(3));// "hellohellohello"functionString.replace<Textendsstring,Uextendsstring|RegExp,Vextendsstring,>(target: T,search: U,replacement: V): Replace<T,U,V>Replaces the first occurrence of search string or regular expression in target string with replace string.
import{String}from"@monstermann/string";String.replace("hello world","world","universe");// "hello universe"String.replace("hello world",/o/g,"0");// "hell0 w0rld"import{String}from"@monstermann/string";pipe("hello world",String.replace("world","universe"));// "hello universe"pipe("hello world",String.replace(/o/g,"0"));// "hell0 w0rld"functionString.replaceAll<Textendsstring,Uextendsstring|RegExp,Vextendsstring,>(target: T,search: U,replacement: V): ReplaceAll<T,U,V>Replaces all occurrences of search string or regular expression in target string with replace string.
import{String}from"@monstermann/string";String.replaceAll("hello world world","world","universe");// "hello universe universe"String.replaceAll("hello world",/o/g,"0");// "hell0 w0rld"import{String}from"@monstermann/string";pipe("hello world world",String.replaceAll("world","universe"));// "hello universe universe"pipe("hello world",String.replaceAll(/o/g,"0"));// "hell0 w0rld"functionString.reverse<Textendsstring>(target: T): Reverse<T>Reverses the characters in target string.
import{String}from"@monstermann/string";String.reverse("hello world");// "dlrow olleh"String.reverse("abc");// "cba"import{String}from"@monstermann/string";pipe("hello world",String.reverse());// "dlrow olleh"pipe("abc",String.reverse());// "cba"functionString.slice<Textendsstring,Uextendsnumber,Vextendsnumber|undefined=undefined,>(target: T,start: U,end?: V): Slice<T,U,V>Extracts a section of target string from start index to end index (exclusive). If end is not provided, extracts to the end of the string.
import{String}from"@monstermann/string";String.slice("hello world",0,5);// "hello"String.slice("hello world",6,11);// "world"String.slice("hello world",6);// "world"import{String}from"@monstermann/string";pipe("hello world",String.slice(0,5));// "hello"pipe("hello world",String.slice(6,11));// "world"pipe("hello world",String.slice(6));// "world"functionString.slugify(target: string): stringConverts target string to a URL-friendly slug format.
The function removes diacritical marks, converts to lowercase, replaces whitespace and separators with hyphens, removes non-alphanumeric characters, and cleans up multiple or leading/trailing hyphens.
import{String}from"@monstermann/string";String.slugify("Hello World");// "hello-world"String.slugify("Café au Lait");// "cafe-au-lait"String.slugify(" Multiple Spaces ");// "multiple-spaces"String.slugify("Special!@#Characters");// "specialcharacters"String.slugify("foo_bar/baz");// "foo-bar-baz"import{String}from"@monstermann/string";pipe("Hello World",String.slugify());// "hello-world"pipe("Café au Lait",String.slugify());// "cafe-au-lait"pipe(" Multiple Spaces ",String.slugify());// "multiple-spaces"pipe("Special!@#Characters",String.slugify());// "specialcharacters"pipe("foo_bar/baz",String.slugify());// "foo-bar-baz"functionString.snakeCase<Textendsstring>(target: T,): SnakeCase<T>Converts target string to snake_case format.
import{String}from"@monstermann/string";String.snakeCase("hello world");// "hello_world"String.snakeCase("helloWorld");// "hello_world"import{String}from"@monstermann/string";pipe("hello world",String.snakeCase());// "hello_world"pipe("helloWorld",String.snakeCase());// "hello_world"functionString.split<Textendsstring,UextendsRegExp>(target: T,delimiter: U,): string[]Splits target string into an array of substrings using source string or regular expression as the separator.
import{String}from"@monstermann/string";String.split("hello,world,test",",");// ["hello", "world", "test"]String.split("hello world",/\s+/);// ["hello", "world"]import{String}from"@monstermann/string";pipe("hello,world,test",String.split(","));// ["hello", "world", "test"]pipe("hello world",String.split(/\s+/));// ["hello", "world"]functionString.startsWith(target: string,source: string): booleanChecks if target string starts with source string.
import{String}from"@monstermann/string";String.startsWith("hello world","hello");// trueString.startsWith("hello world","world");// falseimport{String}from"@monstermann/string";pipe("hello world",String.startsWith("hello"));// truepipe("hello world",String.startsWith("world"));// falsefunctionString.take(target: string,amount: number): stringTakes the first amount characters from target string.
import{String}from"@monstermann/string";String.take("hello world",5);// "hello"import{String}from"@monstermann/string";pipe("hello world",String.take(5));// "hello"functionString.takeLast(target: string,amount: number): stringTakes the last amount characters from target string.
import{String}from"@monstermann/string";String.takeLast("hello world",5);// "world"import{String}from"@monstermann/string";pipe("hello world",String.takeLast(5));// "world"functionString.test(target: string,source: RegExp): booleanTests if target string matches the source regular expression.
import{String}from"@monstermann/string";String.test("hello world",/world/);// trueString.test("hello world",/\d+/);// falseimport{String}from"@monstermann/string";pipe("hello world",String.test(/world/));// truepipe("hello world",String.test(/\d+/));// falsefunctionString.titleCase<Textendsstring>(target: T,): TitleCase<T>Converts target string to Title Case format.
import{String}from"@monstermann/string";String.titleCase("hello world");// "Hello World"String.titleCase("hello-world");// "Hello World"import{String}from"@monstermann/string";pipe("hello world",String.titleCase());// "Hello World"pipe("hello-world",String.titleCase());// "Hello World"functionString.trim<Textendsstring>(target: T): Trim<T>Removes whitespace from both ends of target string.
import{String}from"@monstermann/string";String.trim(" hello world ");// "hello world"import{String}from"@monstermann/string";pipe(" hello world ",String.trim());// "hello world"functionString.trimEnd<Textendsstring>(target: T): TrimEnd<T>Removes whitespace from the end of target string.
import{String}from"@monstermann/string";String.trimEnd(" hello world ");// " hello world"import{String}from"@monstermann/string";pipe(" hello world ",String.trimEnd());// " hello world"functionString.trimStart<Textendsstring>(target: T,): TrimStart<T>Removes whitespace from the start of target string.
import{String}from"@monstermann/string";String.trimStart(" hello world ");// "hello world "import{String}from"@monstermann/string";pipe(" hello world ",String.trimStart());// "hello world "functionString.uncapitalize<Textendsstring>(target: T,): Uncapitalize<T>Uncapitalizes the first letter of target string.
import{String}from"@monstermann/string";String.uncapitalize("Hello World");// "hello World"String.uncapitalize("Hello");// "hello"import{String}from"@monstermann/string";pipe("Hello World",String.uncapitalize());// "hello World"pipe("Hello",String.uncapitalize());// "hello"functionString.upperCase<Textendsstring>(target: T,): Uppercase<T>Converts target string to uppercase.
import{String}from"@monstermann/string";String.upperCase("hello world");// "HELLO WORLD"String.upperCase("Hello World");// "HELLO WORLD"import{String}from"@monstermann/string";pipe("hello world",String.upperCase());// "HELLO WORLD"pipe("Hello World",String.upperCase());// "HELLO WORLD"