.trimAll() | Remove all extra spaces, new line and tabs from string and return single line text having single space between words. |
.toCamelCase() | Convert sentence to camel case. eg. "this is normal string".toCamelCase() -> "thisIsNormalString" |
.toKebabCase() | Convert sentence to kebab case. eg. "this is normal string".toKebabCase() -> "this-is-normal-string" |
.toPascalCase() | Convert sentence to pascal case. eg. "this is normal string".toPascalCase() -> "ThisIsNormalString" |
.toSnakeCase() | Convert sentence to snake case. eg. "this is normal string".toSnakeCase() -> "this_is_normal_string" |
.left(n) | Extract number of characters from left. eg. "this is normal string".left(6) -> "this i" |
.right(n) | Extract number of characters from right. eg. "this is normal string".right(4) -> "ring" |
.mid(m,n) | Extract number of characters (n) from given index (m). eg. "this is normal string".mid(8,6) -> "normal" |
.reverse() | Reverses the string. eg. "this is normal string".reverse() -> "gnirts lamron si siht" |
.sort() | Sort string letters in assending order. eg. "this is normal string".sort() -> " aghiiilmnnorrssstt" |
.sort(fn) | Sort string letters according to compare function (fn) passed. . eg. "this is normal string".sort((a, b) => (a < b ? 1 : -1)) -> "ttsssrronnmliiihga " |
.sortAsc() | Sort string letters in assending order. eg. "this is normal string".sortAsc() -> " aghiiilmnnorrssstt" |
.sortDesc() | Sort string letters in descending order. eg. "this is normal string".sortDesc() -> "ttsssrronnmliiihga " |
.distinct() | Extract unique/distinct characters from string and return string. eg. "this is normal string".distinct() -> "this normalg" |
.toNumber() | Convert string number to numeric value or NaN. eg. "123.45".toNumber() -> 123.45 |
.toNumber() | Convert string number to numeric value or NaN. eg. "a123.45".toNumber() -> NaN |
.toNumber(NaN_Value) | Convert string number to numeric value. on fail return NaN_Value. eg. "a123.45".toNumber(0) -> 0 |
.toNumber(itself) | Convert string number to numeric value. on fail return original string itself. eg. "a123.45".toNumber(itself) -> "a123.45" |
.parseInt() | Convert string to integer value and round up the fraction value. eg. "123.45".parseInt() -> 123 |
.parseInt() | Convert string to integer value and round up the fraction value. eg. "a123.45".parseInt() -> NaN |
.parseInt(redix) | Convert string to integer value on the basis of basevalue/redix. eg. "AF2F".parseInt(16) -> 44847 |
.parseInt(redix,NaN_Value) | Convert string to integer value on the basis of basevalue/redix. eg. "AF2F".parseInt(10,0) -> 0 |
.parseInt(redix,itself) | Convert string to integer value on the basis of basevalue/redix. eg. "AF2F".parseInt(8,itself) -> "AF2F" |
.parseFloat() | Convert string number to numeric value or NaN. eg. "123.45".parseFloat() -> 123.45 |
.parseFloat() | Convert string number to numeric value or NaN. eg. "a123.45".parseFloat() -> NaN |
.parseFloat(NaN_Value) | Convert string number to numeric value. on fail return NaN_Value. eg. "a123.45".parseFloat(0) -> 0 |
.parseFloat(itself) | Convert string number to numeric value. on fail return original string itself. eg. "a123.45".parseFloat(itself) -> "a123.45" |
.toInt() | Convert string to integer value and round up the fraction value. eg. "123.45".toInt() -> 123 |
.toInt() | Convert string to integer value and round up the fraction value. eg. "a123.45".toInt() -> NaN |
.toInt(redix) | Convert string to integer value on the basis of basevalue/redix. eg. "AF2F".toInt(16) -> 44847 |
.toInt(redix,NaN_Value) | Convert string to integer value on the basis of basevalue/redix. eg. "AF2F".toInt(10,0) -> 0 |
.toInt(redix,itself) | Convert string to integer value on the basis of basevalue/redix. eg. "AF2F".toInt(8,itself) -> "AF2F" |
.toFloat() | Convert string number to numeric value or NaN. eg. "123.45".toFloat() -> 123.45 |
.toFloat() | Convert string number to numeric value or NaN. eg. "a123.45".toFloat() -> NaN |
.toFloat(NaN_Value) | Convert string number to numeric value. on fail return NaN_Value. eg. "a123.45".toFloat(0) -> 0 |
.toFloat(itself) | Convert string number to numeric value. on fail return original string itself. eg. "a123.45".toFloat(itself) -> "a123.45" |
.isNaN() | Check wheter string can be convert to numeric or not. return true/false. eg. "1234.56".isNaN() -> false |
.isNaN() | Check wheter string can be convert to numeric or not. return true/false. eg. "a1234.56".isNaN() -> true |
.isNaN(NaN_Value) | Convert string to numeric value. eg. "1234.56".isNaN(0) -> 1234.56 |
.isNaN(NaN_Value) | Convert string to numeric value. eg. "a1234.56".isNaN(0) -> 0 |
.isNaN(itself) | Convert string to numeric value. eg. "a1234.56".isNaN(itself) -> "a1234.56" |
.toArray() | Convert strint to characters array. eg. "abcd".toArray() -> ["a", "b", "c", "d"] |
.toCodeArray() | Convert string to array of character ascii/unicode code. eg. "abcde".toCodeArray() -> [97, 98, 99, 100, 101] |
.toCharCodeArray() | Convert string to array of object {char:'char',code:number}. eg. "abcde".toCharCodeArray() -> [{char: "a", code: 97},{char: "b", code: 98},{char: "c", code: 99},{char: "d", code: 100},{char: "e", code: 101}] |
.toCharCode() | Convert string to object {char:code,char:code} eg. "abcd".toCharCode() -> { a : 97, b : 98, c : 99, d : 100 } |
.frequency() | Calculate frequency of charactes in string and return object having character as key and frequency as value. eg. "this is a sample string".frequency() -> {" ": 4, a: 2, e: 1, g: 1, h: 1, i: 3, l: 1, m: 1, n: 1, p: 1, r: 1, s: 4, t: 2} "thisIsASampleString".frequency() -> {A: 1,I: 1,S: 2,a: 1,e: 1,g: 1,h: 1,i: 2,l: 1,m: 1,n: 1,p: 1,r: 1,s: 2,t: 2} |
.frequency(isInSensitive) | Optional if true then it matches without case check(ignore case) eg. "thisIsASampleString".frequency(true) -> {a: 2,e: 1,g: 1,h: 1,i: 3,l: 1,m: 1,n: 1,p: 1,r: 1,s: 4,t: 2} |
.frequency(char) | Optional Character if passed then return only that char frequency. eg "thisIsASampleString".frequency('i') -> 2 |
.frequency(char,isInSensitive) | return frequency of char with ignore case. eg. "thisIsASampleString".frequency('i', true) -> 3 |
.toDateTime() | Convert any valid string date to Date data type. If unable to convert the given string to date return date value of "1-JAN-1900" date data type. eg. "1-jan-2021".toDateTime() -> Fri Jan 01 2021 00:00:00 GMT+0530 (India Standard Time) "1-Mar".toDateTime() -> Mon Mar 01 2021 00:00:00 GMT+0530 (India Standard Time) "Mar,2022".toDateTime() -> Tue Mar 01 2022 00:00:00 GMT+0530 (India Standard Time) "2021".toDateTime() -> Fri Jan 01 2021 05:30:00 GMT+0530 (India Standard Time) "1/5/2021".toDateTime() -> Sat May 01 2021 00:00:00 GMT+0530 (India Standard Time) "01/05/2021 5:55 AM".toDateTime() -> Sat May 01 2021 05:55:00 GMT+0530 (India Standard Time) "01/08/2021 5:15:16 PM".toDateTime() -> Sun Aug 01 2021 17:15:16 GMT+0530 (India Standard Time) "12:15:16 AM".toDateTime() -> Thu Aug 05 2021 00:15:16 GMT+0530 (India Standard Time) //current date with given time "invalid date string".toDateTime() -> Mon Jan 01 1900 00:00:00 GMT+0521 (India Standard Time) |
.toDate() | Convert String to only Date value exclude time value. eg. "05-Aug-2021 05:25:15 AM".toDate() -> Thu Aug 05 2021 00:00:00 GMT+0530 (India Standard Time) |
.isString | [Boolean Property] return true if variable value is string else false. eg. "abcd".isString -> true let a="string"; a.isString ->true let b=34; b.isString; -> false |