Methods
(inner) abstract()
Abbreviates the contents of one or more fields by:
- Selecting the most significant words in a body of text
- Abbreviating common words
- Dropping vowels from words
- Removing unnecessary text or characters, such as mail headers or white space
- To Do
- this needs to be implemented
method not implemented
- Type
- Error
(inner) abstractSimple(bodyFields) → {TextOrTextList}
Creates a short abstract of a text or rich text field. Simpler and more efficient than using @Abstract.
Name | Type | Description |
---|---|---|
bodyFields | TextOrTextList | Any number of fields containing the text to abstract. May be text or rich text fields. If Notes/Domino cannot locate a field by name, it uses the string literal instead. Enclose each field name in quotes and separate multiple names with colons: "Sales":"Figures". |
- See
- For further information, see www.hcltechsw.com
Returns the first 100 characters or first 2 paragraphs of text, whichever is smaller. All newline and tab characters are converted into spaces, and all empty paragraphs (containing only a newline character) are ignored. If the parameter is a single field, a text value is returned. If the parameter is a list of field names, then a text list is returned with each list element containing the abstracted text of the corresponding field in the parameter list. If a field parameter is of an invalid type, or can't be found, the text returned is the string of the field parameter.
- Type:
- TextOrTextList
// If the field "Verse" contains the rich text:
// "One bright day
// in the middle of
// the night"
rosettajs.Text.abstractSimple("Verse"); // returns "One bright day in the middle of"
// If the field "Critics" contains the rich text:
// "When asked to comment on the movie, the reviewer stated that it was one of the year's best, and certainly would find a place on many award lists."
rosettajs.Text.abstractSimple("Critics"); // returns "When asked to comment on the movie, the reviewer stated that it was one of the year's best, and cert"
(inner) asc(text)
Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters.
Name | Type | Description |
---|---|---|
text | * | The text or a reference to a value that contains the text you want to change. If text does not contain any full-width letters, text is not changed. |
- See
- For further information, see docs.oasis-open.org
- To Do
- this needs to be implemented
method not implemented
- Type
- Error
(inner) ascii(text, optionopt) → {TextOrTextList}
Converts an LMBCS (Lotus Multi-Byte Character Set) string to an ASCII string.
Name | Type | Attributes | Description |
---|---|---|---|
text | TextOrTextList | An LMBCS string. | |
option | boolean | <optional> | "ALLINRANGE" will return a null string ("") if any characters in the original string cannot be represented by ASCII codes 32 to 127. |
- See
- For further information, see www.hcltechsw.com
The original string, with each character converted to an ASCII-compliant character. Any character that can't be represented by ASCII codes 32 to 127 is replaced with a question mark (?). If you specify "ALLINRANGE" and there are characters that can't be represented by ASCII codes 32 to 127, returns a null string ("").
- Type:
- TextOrTextList
rosettajs.Text.ascii( "Çüé" ); // returns Cue
// Returns a null string ("") since the last 2 characters can't be represented by ASCII codes 32 to 127
rosettajs.Text.ascii("Çü飥", "ALLINRANGE");
rosettajs.Text.ascii(["Çü飥", "Çüé", "Abc"]); // returns ['Cue??', 'Cue', 'Abc']
(inner) bahtText(number)
Converts a number to text, using the ß (baht) currency format.
Name | Type | Description |
---|---|---|
number | number | A number you want to convert to text, or a reference to a value containing a number, or a formula that evaluates to a number. |
- See
- For further information, see support.microsoft.com
- To Do
- this needs to be implemented
method not implemented
- Type
- Error
(inner) begins(within_text, find_text) → {boolean}
Determines whether a particular substring is stored at the beginning of another string.
This function is case-sensitive. If the either parameter is a list, the function tests each element of the second parameter against each element of the first parameter and returns true if any match occurs.
Name | Type | Description |
---|---|---|
within_text | string | Any string. |
find_text | string | The string you want to search for at the beginning of string. |
- See
- For further information, see www.hcltechsw.com
true if substring is contained within string, beginning from the first letter. Returns false if not. This function is case-sensitive. If the either parameter is a list, the function tests each element of the second parameter against each element of the first parameter and returns true if any match occurs.
- Type:
- boolean
rosettajs.Text.begins('Miriam-McGovern','Miriam'); // returns true
rosettajs.Text.begins('Miriam-McGovern',['Abc','Miri']); // returns true
rosettajs.Text.begins(['John Jones','Mary Hill'],['Mi', 'Pa']); // returns false;
(inner) char(number) → {TextOrTextList}
Converts IBM Code Page 850 code number into the corresponding single character string.
Name | Type | Description |
---|---|---|
number | NumberOrNumberList | Any number between 0 and 255. Non-integer numbers are truncated to integers.If the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements. |
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
A single character that corresponds to codeNumber. and docs.oasis-open.org
- Type:
- TextOrTextList
rosettajs.Text.char(65); // returns "A"
rosettajs.Text.char(237); // returns "Ý"
rosettajs.Text.char(253); // returns "²"
rosettajs.Text.char([65, 157, 'invalid', 169]); // returns ["A", "Ø", error.value, "®"];
(inner) clean(text) → {string}
Removes all non-printable characters from text.
Name | Type | Description |
---|---|---|
text | string | Any worksheet information from which you want to remove nonprintable characters. |
- See
- For further information, see docs.oasis-open.org
The text without the non-printable characters.
- Type:
- string
rosettajs.Text.clean(`${rosettajs.Text.char(9)}Monthly report${rosettajs.Text.char(10)}`); // Removes the nonprintable characters CHAR(9) and CHAR(10) from the text string
(inner) code(text) → {number}
Returns a numeric code for the first character in a text string.
Name | Type | Description |
---|---|---|
text | string | The text for which you want the code of the first character. |
- See
- For further information, see docs.oasis-open.org
The character code for the first character in text.
- Type:
- number
rosettajs.Text.code("A"); // Return 65
(inner) compare(textlist1, textlist2, optionsopt) → {Array.<number>}
Compares the alphabetic order of the elements in two lists pair-wise.
Name | Type | Attributes | Description |
---|---|---|---|
textlist1 | Array.<string> | A list of strings to compare. If textlist1 is shorter than textlist2, the last element in textlist1 is repeated until it reaches the same length as textlist2. | |
textlist2 | Array.<string> | A list of strings to compare. If textlist2 is shorter than textlist1, the last element in textlist2 is repeated until it reaches the same length as textlist1. | |
options | string | | <optional> | You can use the following keywords to specify the compare options:
By default, the following keywords are used for the compare: ["CASESENSITIVE", "ACCENTSENSITIVE", "PITCHSENSITIVE"] |
- See
- For further information, see www.hcltechsw.com
Each element is the result of comparing the corresponding elements in the text lists, and is one of three values:
- 0 if the elements in the two lists are equal.
- -1 if the element in the first list is less than the element in the second list.
- 1 if the element in the first list is greater than the element in the second list.
- Type:
- Array.<number>
rosettajs.Text.compare("Boston", "boston", "CASESENSITIVE"); // Returns 1
// Compares a list to the value "N" and returns [-1, 1, -1, 0, 0]. Boston and Moscow result in -1 (less than N), Tokyo results in 1 (greater than N), and n and N result in 0 (equal to N).
rosettajs.Text.text(rosettajs.Text.compare(["Boston", "Tokyo", "Moscow", "N", "n"], "N", "CASEINSENSITIVE"));
(inner) concat(…items) → {string}
Joins several text items into one text item.
Name | Type | Attributes | Description |
---|---|---|---|
items | Array.<string> | <repeatable> | The items to join. |
- See
- For further information, see support.microsoft.com
The concatenated string.
- Type:
- string
rosettajs.Text.concat("The"," ","sun"," ","will"," ","come"," ","up"," ","tomorrow."); // Returns "The sun will come up tomorrow."
(inner) concatenate(…items) → {string}
Joins several text items into one text item.
Name | Type | Attributes | Description |
---|---|---|---|
items | Array.<string> | <repeatable> | The items to join. |
- See
- For further information, see docs.oasis-open.org
The concatenated string.
- Type:
- string
rosettajs.Text.concatenate("Tokyo", ", ", "Japan"); // Returns "Tokyo, Japan"
(inner) contains(within_text, find_text) → {boolean}
Determines whether a substring is stored within a string.
This function is case-sensitive. If either parameter is a list, the function returns true if any element of the first parameter contains any element of the second parameter.
Name | Type | Description |
---|---|---|
within_text | TextOrTextList | The string(s) you want to search. |
find_text | TextOrTextList | The string(s) you want to search for in string. |
- See
- For further information, see www.hcltechsw.com
True if any substring is contained in one of the strings. False if no substrings are contained in any of the strings.
- Type:
- boolean
rosettajs.Textcontains('Miriam-McGovern','iam'); // returns 1
rosettajs.Text.contains('Miriam-McGovern',['Abc','McG']); // returns 1
rosettajs.Text.contains(['John Jones','Mary Hill'],['hi', 'Pa']); // returns 0;
(inner) dollar(number, decimalsopt) → {string}
Converts a number to text, using the $ (dollar) currency format.
Name | Type | Attributes | Description |
---|---|---|---|
number | number | A number, a reference to a value containing a number, or a formula that evaluates to a number. | |
decimals | number | <optional> | Optional. The number of digits to the right of the decimal point. If this is negative, the number is rounded to the left of the decimal point. If you omit decimals, it is assumed to be 2. |
- See
- For further information, see docs.oasis-open.org
Text using currency format, with the decimals rounded to the number of places you specify.
- Type:
- string
rosettajs.Text.dollar(1234.567); // Returns "$1,234.57"
(inner) ends(within_text, find_text) → {boolean}
Determines if a substring is at the end of a string.
This function is case-sensitive. If the either parameter is a list, the function tests each element of the second parameter against each element of the first parameter and returns 1 if any match occurs.
Name | Type | Description |
---|---|---|
within_text | TextOrTextList | Text or text string. Any string. |
find_text | TextOrTextList | Text or text string. The string you want to search for at the beginning of string. |
- See
- For further information, see www.hcltechsw.com
True indicates that the find_text is at the end of within_test. Otherwise false if not.
- Type:
- boolean
rosettajs.Text.ends('Miriam-McGovern','McGovern'); // returns 1
rosettajs.Text.ends('Miriam-McGovern',['Abc','Vern']); // returns 0
rosettajs.Text.ends(['John Jones','Mary Hill'],['Ma', 'Hill']); // returns 1
(inner) exact(text1, text2)
Checks to see if two text values are identical.
Name | Type | Description |
---|---|---|
text1 | string | The first text string. |
text2 | string | The second text string. |
- See
- For further information, see docs.oasis-open.org
True if the two values are identical. False if they are not identical.
rosettajs.Text.exact("A","A"); // Returns true
rosettajs.Text.exact("A","a"); // Returns false
rosettajs.Text.exact("1",1); // Returns true
(inner) fileDir(pathname) → {TextOrTextList}
Returns the directory portion of a path name, that is, the path name minus the file name.
Name | Type | Description |
---|---|---|
pathname | TextOrTextList | Path name of a file. |
- See
- For further information, see www.hcltechsw.com
The directory part of the path name.
- Type:
- TextOrTextList
rosettajs.Text.fileDir("c:\\europe.dat"); // Returns "c:\"
rosettajs.Text.fileDir("c:\\market\\data\\europe.dat":"\\europe.dat"); // Returns "c:\" : "\"
rosettajs.fileDir("europe.dat"); // Returns Null
(inner) find(find_text, within_text, start_numopt) → {number|Error}
Locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
find_text | string | The text you want to find. | ||
within_text | string | The text containing the text you want to find. | ||
start_num | number | <optional> | 0 | Specifies the character at which to start the search. The first character in within_text is character number 1. If you omit start_num, it is assumed to be 1. |
- See
- For further information, see docs.oasis-open.org
The number of the starting position or an error if the string was not found.
- Type:
- number |
Error
rosetta.Text.find("b","abcabc"); // Returns 2
rosetta.Text.find("b","abcabcabc",3); // Returns 5
(inner) fixed(number, decimals, no_commas) → {string}
Formats a number as text with a fixed number of decimals.
Name | Type | Default | Description |
---|---|---|---|
number | number | The number you want to round and convert to text. | |
decimals | number | 2 | Optional. The number of digits to the right of the decimal point. |
no_commas | boolean | false | Optional. A logical value that, if TRUE, prevents FIXED from including commas in the returned text. |
- See
- For further information, see docs.oasis-open.org
The string representation of the number
- Type:
- string
rosettajs.Text.fixed(1234.567, 1); // Returns "1234.6"
rosettajs.Text.fixed(-1234.567, -1, true); // Returns "-1230"
(inner) isTime(value) → {boolean}
Indicates whether a value is a time-date (or a time-date list).
Name | Type | Description |
---|---|---|
value | * | any value |
- See
- For further information, see www.hcltechsw.com
True if the value ia a time-date or a time-date list. Othewise false.
- Type:
- boolean
rosettajs.Text.isTime("08/31/2002"); // Returns true
rosettajs.Text.isTime(123); // Returns false
(inner) left(text, param) → {TextOrTextList}
Searches a string from left to right and returns the leftmost characters of the string.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string where you want to find the leftmost characters. |
param | number | |
|
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
The leftmost characters in stringToSearch. The number of characters returned is determined by either numberOfChars or subString. Left returns "" if subString is not found in stringToSearch. and docs.oasis-open.org
- Type:
- TextOrTextList
rosettajs.left('Sale Price', 4); // returns 'Sale'
rosettajs.left('Sweden', 'en'); // returns 'Swed'
rosettajs.left(['Sweden', 'England'], 2); // returns ['Sw', 'En']
(inner) leftBack(stringToSearch, param) → {string}
Searches a string from right to left and returns a substring.
Name | Type | Description |
---|---|---|
stringToSearch | TextOrTextList | The string where you want to find the leftmost characters. |
param | number | Counting from right to left, the number of characters to skip. All the characters to the left of that number of characters are returned. If the number is negative, the entire string is returned. |
- See
- For further information, see www.hcltechsw.com
Text or text list. The leftmost characters in stringToSearch. The number of characters returned is determined by either numToSkip or startString.
- Type:
- string
rosettajs.Text.leftBack('Sale Price', 4); // returns 'Sale P'
rosettajs.Text.leftBack('Sweden', 'en'); // returns 'Swed'
rosettajs.Text.leftBack(['Sweden', 'England'], 2); // returns ['Swed', 'Engl']
(inner) len(text) → {number}
Returns the number of characters in a text string
Name | Type | Description |
---|---|---|
text | string | The text whose length you want to find. Spaces count as characters. |
- See
- For further information, see docs.oasis-open.org
The number of characters in text.
- Type:
- number
rosetta.Text.len("Hi There"); // Returns 8
rosetta.Text.len(""); // Returns 0
rosetta.Text.len(55); // Returns 2. Number are automatically converted to strings.
(inner) length(text) → {NumberOrNumberList}
Returns the number of characters in a text string.
Name | Type | Description |
---|---|---|
text | TextOrTextList | A single string with the length you want to find, or a list of strings. |
- See
- For further information, see www.hcltechsw.com
If the parameter is a text string, length returns the number of characters in the specified string, including spaces and punctuation. If the argument is a text list, length searches the list of strings and returns the number of characters in each string as a number list.
- Type:
- NumberOrNumberList
rosettajs.Text.length('four'); // returns 4
rosettajs.Text.length('four', 'seven'); // returns [4, 5]
rosettajs.Text.length('four', 12); // returns [4, 0]
(inner) like(text, pattern, escapeopt) → {boolean}
Matches a string with a pattern. It is case-sensitive.
Name | Type | Attributes | Description |
---|---|---|---|
text | TextOrTextList | The value to be tested to see if it matches pattern. | |
pattern | TextOrTextList | The sequence of characters to search for within text. May also contain any of the wildcard characters listed as follows:
| |
escape | string | <optional> | A character to use before a wildcard character to indicate that it should be treated literally. |
- See
- For further information, see www.hcltechsw.com
True if the pattern matches the text. False if the pattern does not matches the text.
- Type:
- boolean
// Return false. The underscore matches only a single character.
rosettajs.Text.like( "A big test", "A_test");
// Returns true because the match is true for one element of the first parameter.
rosettajs.Text.like( ["A big test", "A big exam"], "%test" );
// Returns true. The first percent matches "100." The "/%" matches the percent sign because "/" is specified as the escape character. The last percent matches "ement."
rosettajs.Text.like( "A 100% improvement", "A %/% improv%", "/" )
(inner) lower(text) → {string}
Converts text to lowercase.
Name | Type | Description |
---|---|---|
text | string | The text you want to convert to lowercase. LOWER does not change characters in text that are not letters. |
- See
- For further information, see docs.oasis-open.org
The lower case text.
- Type:
- string
rosetta.Text.lower("HELLObc7"); // Returns "hellobc7"
(inner) lowerCase(text) → {TextOrTextList}
Converts the uppercase letters in the specified string to lowercase.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string you want to convert to lowercase. |
- See
- For further information, see www.hcltechsw.com
The string, converted to lowercase letters.
- Type:
- TextOrTextList
rosettajs.Text.lowerCase('ABcd'); // returns 'abcd'
rosettajs.Text.lowerCase('ABcd', 'efGH'); // returns ['abcd', 'efgh']
(inner) matches(text, pattern) → {boolean}
Tests a string for a pattern string. Because the pattern string can contain a number of "wildcard" characters and logical symbols, you can test for complex character patterns.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string you want to scan in quotes. You can also enter the field name of a field that contains the string you want to scan; do not surround the field name in quotes. |
pattern | TextOrTextList | The pattern you want to scan for in string surrounded by quotation marks. May contain wildcard characters and symbols (see the following table). The following symbols require a preceding backslash unless the pattern is enclosed in braces { } as a set: ?, *, &, !, |, , +. The symbols require two preceding backslashes instead of one if the pattern is specified as a literal. This is because the backslash is an escape character in string literals, so "?" passes "?" to the matching engine, where it is treated as a wildcard, while "\?" passes "?" to the matching engine, where it is treated as a question mark character. The wildcard characters and symbols are as follows:
|
- See
- For further information, see www.hcltechsw.com
True if text contains the pattern. False if text does not contain the pattern.
- Type:
- boolean
rosettajs.Text.matches("A big test", "a?????test"); // Returns true
rosettajs.Text.matches("A big test", "a?test"); // Returns false
// Throws error, "Value cannot be a letter" if input contains any lowercase or uppercase letter between A and Z
if(rosettajs.Text.matches(rosettajs.Text.text(input), "+{A-z}")) throw new Error("Value cannot be a letter");
(inner) mid(text, start_num, num_chars) → {string}
Returns a specific number of characters from a text string starting at the position you specify
Name | Type | Description |
---|---|---|
text | string | The text string containing the characters you want to extract. |
start_num | number | The position of the first character you want to extract in text. The first character in text has start_num 1, and so on. |
num_chars | number | Specifies the number of characters you want MID to return from text. |
- See
- For further information, see docs.oasis-open.org
The text from the starting position.
- Type:
- string
rosettajs.Text.mid("123456789",5,3); // Returns "567"
rosettajs.Text.mid("123456789",20,3); // Returns "". If Start is beyond string, return empty string.
(inner) middle(text, start, end) → {TextOrTextList}
Returns any substring from the middle of a string. The middle is found by scanning the string from left to right, and parameters determine where the middle begins and ends.
Name | Type | Description |
---|---|---|
text | TextOrTextList | Any string |
start | number | | If a number, a character position in text that indicates where you want the middle to begin, always counting from left to right. The middle begins one character after the start. If a string, a substring of text that indicates where you want the middle to begin, always counting from left to right. The middle begins one character after the end of start. |
end | number | | If a number, the number of characters that you want in the middle. If end is negative, the middle starts at start and continues from right to left. If end is positive, the middle starts one character past start and continues from left to right. If a string, a substring of text that indicates the end of the middle. Returns all the characters between start and end. |
- See
- For further information, see www.hcltechsw.com
The substring from the middle of text, which begins at the start you specify and ends at the end you specify, or after end characters have been reached.
- Type:
- TextOrTextList
rosettajs.Text.middle('North Carolina', ' ', 3); // returns 'Car'
rosettajs.Text.middle('This is the text', 4, 'text); // returns ' is the '
rosettajs.Text.middle(["Hello world", "This is the time"], 0, " "); // returns ['Hello', 'This']
(inner) middleBack(text, start, end) → {TextOrTextList}
Returns any substring from the middle of a string. The middle is found by scanning the string from right to left, and parameters determine where the middle begins and ends.
Name | Type | Description |
---|---|---|
text | TextOrTextList | Any string. |
start | number | | If a number, a character position in text that indicates where you want the middle to begin, always counting from right to left. The middle begins one character after the start. Always add 1 to this number; the end of the string is marked by one non-visible character and must be counted in the offset. If a string, a substring of text that indicates where you want the middle to begin, always counting from right to left. The middle begins one character after the end of start. |
end | number | | If a number, The number of characters that you want in the middle. If end is negative, the middle starts at start and continues from right to left. If end is positive, the middle starts one character past start and continues from left to right. If a string, a substring of string that indicates the end of the middle. Returns all the characters between start and end. |
- See
- For further information, see www.hcltechsw.com
The substring from the middle of string, which begins at the offset or startString you specify and ends at the endstring you specify, or after the numberchars have been reached.
- Type:
- TextOrTextList
rosettajs.Text.middleBack('Fluid Flow', 0, 5); // returns 'Flow'
rosettajs.Text.middleBack('This is the text', 'text', 'is'); // returns ' the '
rosettajs.Text.middleBack(["Hello world", "This is the time"], 0, " "); // returns ["world", "time"]
(inner) narrow(text) → {TextOrTextList}
Converts full-pitch alphanumeric characters (double byte characters -- DBCS) in the specified string to half-pitch alphanumeric characters (single byte characters -- SBCS). This function works in Japanese, Korean, Simplified Chinese, and traditional Chinese environments. In the Japanese environment, this function can convert full-pitch Katakana as well.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string that you want to convert to single byte characters. |
- See
- For further information, see www.hcltechsw.com
The string converted to single byte characters.
- Type:
- TextOrTextList
rosettajs.Text.narrow("0123456789ABCDEFGHI"); // returns "0123456789ABCDEFGHI"
rosettajs.Text.narrow(["0123456789ABCDEFGHI", "アイウABCエオカㄱㄲㄳ"]); // returns ["0123456789ABCDEFGHI", "アイウABCエオカᄀᄁᆪ"]
(inner) newLine() → {string}
Returns a new line (carriage return) into a text string.
- See
- For further information, see www.hcltechsw.com
The new line character
- Type:
- string
// Returns "Hi
// There"
var greeting = "Hi" + rosettajs.Text.newLine() + "There";
(inner) numberValue(text, decimal_separatoropt, group_separatoropt) → {number}
Converts text to number in a locale-independent manner.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
text | string | The text to convert to a number. | ||
decimal_separator | string | <optional> | "." | Optional. The character used to separate the integer and fractional part of the result. |
group_separator | string | <optional> | "," | Optional. The character used to separate groupings of numbers, such as thousands from hundreds and millions from thousands. |
- See
- For further information, see support.microsoft.com
The number represented by the text.
- Type:
- number
rosettajs.Text.numberValue("2.500,27",",","."); // Returns 2,500.27
(inner) proper(text) → {string}
Capitalizes the first letter in each word of a text value.
Name | Type | Description |
---|---|---|
text | string | Text enclosed in quotation marks, a formula that returns text, or a reference to a value containing the text you want to partially capitalize. |
- See
- For further information, see docs.oasis-open.org
The text with all words starting with a capital letter.
- Type:
- string
rosettajs.Text.proper("hello there"); // Returns "Hello There"
rosettajs.Text.proper("HELLO.THERE"); // Returns "Hello.There". Words are separated by spaces, punctuation, etc.
(inner) properCase() → {TextOrTextList}
Converts the words in a string to proper-name capitalization: the first letter of each word becomes uppercase, all others become lowercase.
Name | Type | Description |
---|---|---|
text. | TextOrTextList | The string you want to convert. |
- See
- For further information, see www.hcltechsw.com
The string, converted to proper-name capitalization.
- Type:
- TextOrTextList
rosettajs.Text.properCase('a title case'); // returns 'A Title Case'
rosettajs.Text.properCase('a title case','is awaiting trial'); // returns ['A Title Case','Is Awaiting Trial']
(inner) repeat(text, number, maxcharopt) → {TextOrTextList}
Repeats a string a specified number of times.
Name | Type | Attributes | Description |
---|---|---|---|
text | TextOrTextList | The string you want to repeat. | |
number | Number | The number of times you want to repeat string. | |
maxchar | Number | <optional> | The maximum number of characters you want returned. Repeat truncates the result to this number. |
- See
- For further information, see www.hcltechsw.com
The string, repeated number times until numberchars (if specified) is reached.
- Type:
- TextOrTextList
rosettajs.Text.repeat('multiple ', 3); // returns 'multiple multiple multiple '
rosettajs.Text.repeat(['multiple ', 'hits '], 3); // returns ['multiple multiple multiple ', 'hits hits hits ']
rosettajs.Text.repeat(['multiple ', 'hits '], 3, 10); // returns ['multiple m', 'hits hits ']
(inner) replace(old_text, start, length, new_text) → {string}
Replaces characters within text
Name | Type | Description |
---|---|---|
old_text | string | Text in which you want to replace some characters. |
start | number | The starting character position in old_text that you want REPLACE to replace with new_text. |
length | number | The number of characters in old_text that you want REPLACEB to replace with new_text. |
new_text | string | The text that will replace characters in old_text. |
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
The text with the characters replaced.
- Type:
- string
rosettajs.Text.replace("123456789",5,3,"Q"); // Returns "1234Q89"
(inner) replaceSubstring(source, from, to) → {TextOrTextList}
Replaces specific words or phrases in a string with new words or phrases that you specify. Case sensitive.
Name | Type | Description |
---|---|---|
source | TextOrTextList | The string whose contents you want to modify. |
from | TextOrTextList | A list containing the words or phrases that you want to replace. |
to | TextOrTextList | A list containing the replacement words or phrases. |
- See
- For further information, see www.hcltechsw.com
The sourceList, with any values from fromList replaced by the corresponding value in toList. If none of the values in fromList matched the values in sourceList, then sourceList is returned unaltered.
- Type:
- TextOrTextList
rosettajs.Text.replaceSubstring("I like apples", "like", "hate"); // returns 'I hate apples'
rosettajs.Text.replaceSubstring("I like apples", ["like", "apples"], ["hate", "peaches"]); // returns 'I hate peaches'
rosettajs.Text.replaceSubstring(["I like apples", "I like bananas"], ["like", "I"], ["hates", "He"]); // returns ["He hates apples", "He hates bananas"]
(inner) rept(text, number_times) → {string}
Repeats text a given number of times.
Name | Type | Description |
---|---|---|
text | string | The text you want to repeat. |
number_times | number | A positive number specifying the number of times to repeat text. |
- See
- For further information, see docs.oasis-open.org
The string containing the repeating text.
- Type:
- string
rosettajs.Text.rept("X",3); // Returns "XXX"
rosettajs.Text.rept("X",0); // Returns ""
(inner) right(text, param) → {TextOrTextList}
Returns the rightmost characters in the string. You can specify the number of rightmost characters you want returned, or you can indicate that you want all the characters following a specific substring.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string whose rightmost characters you want to find. |
param | number | |
|
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
The rightmost characters in stringToSearch. The number of characters returned is determined by param. Right returns "" if subString is not found in stringToSearch. and docs.oasis-open.org
- Type:
- TextOrTextList
rosettajs.right('Sale Price', 5); // returns 'Price'
rosettajs.right('Lennard Wallace', " "); // returns 'Wallace'
rosettajs.right(['Lennard', 'Wallace'], 3); // returns ['ard', 'ace']
(inner) rightBack(text, param) → {TextOrTextList}
Returns the rightmost characters in a string.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string whose rightmost characters you want to find. |
param | number | | If a number, counting from left to right, the number of characters to skip. All the characters following that number are returned. If a string, A substring of text. Returns all the characters following param. It finds param by searching text from right to left. |
- See
- For further information, see www.hcltechsw.com
The rightmost characters in text. The number of characters returned is determined by param.
- Type:
- TextOrTextList
rosettajs.Text.rightBack('Sale Price', 5); // returns 'Price'
rosettajs.Text.rightBack('Lennard Wallace', " "); // returns 'Wallace'
rosettajs.Text.rightBack(['Lennard', 'Wallace'], 3); // returns ['nard', 'lace']
(inner) search(find_text, within_text, start_numopt) → {number|Error}
Finds one text value within another (not case-sensitive)
Name | Type | Attributes | Description |
---|---|---|---|
find_text | string | The text that you want to find. | |
within_text | string | The text in which you want to search for the value of the find_text argument. | |
start_num | number | <optional> | Optional. The character number in the within_text argument at which you want to start searching. |
- See
- For further information, see docs.oasis-open.org
The starting index of find_text in within_text or an Error if find_text is not found.
- Type:
- number |
Error
rosettajs.Text.search('e', 'Statements', 6); // Returns 7
rosettajs.Text.search('margin', 'Profit Margin'); // Returns 8
(inner) substitute(text, old_text, new_text, instance_numopt) → {string}
Substitutes new text for old text in a text string.
Name | Type | Attributes | Description |
---|---|---|---|
text | string | The text or the reference to a value containing text for which you want to substitute characters. | |
old_text | string | The text you want to replace. | |
new_text | string | The text you want to replace old_text with. | |
instance_num | number | <optional> | Optional. Specifies which occurrence of old_text you want to replace with new_text. If you specify instance_num, only that instance of old_text is replaced. Otherwise, every occurrence of old_text in text is changed to new_text. |
- See
- For further information, see docs.oasis-open.org
The string with the substituted text.
- Type:
- string
rosettajs.Text.substitute("121212","2","ab"); // Returns "1ab1ab1ab"
rosettajs.Text.substitute("121212","2","ab",2); // Returns "121ab12"
rosettajs.Text.substitute("Hello","x","ab"); // If not found, returns unchanged
(inner) t(value) → {string}
Return the text (if text), else return 0-length Text value
Name | Type | Description |
---|---|---|
value | * | The value you want to test if text. |
- See
- For further information, see docs.oasis-open.org
Returns value if it is a string; otherwise an empty string.
- Type:
- string
rosettajs.Text.t("HI"); // Returns "HI"
rosettajs.Text.t(5); // Return ""
(inner) text(value, format) → {TextOrTextList}
Converts any value to a text string.
Name | Type | Description |
---|---|---|
value | * | Any value you want to convert to text. |
format | TextOrTextList | format strings used to determine how the text is returned. For Open Formula, the format is required and only the first format string is used. For Notes, the format is optional and can be up to four format strings. These determine how the text is returned. If value is already a string, format is ignored. This parameter is currently not implemented for Notes Formula. |
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
The value you specified, converted to text. If you used any format-strings, they are applied. and docs.oasis-open.org
- Type:
- TextOrTextList
rosettajs.Text.text(123.45); // Returns "123.45" if using Notes Formula implementation
rosettajs.Text.text(0.285,"0.0%"); // Returns "28.5" if using Open Formula implementation
(inner) textAlignCenter()
Centers the current text.
no plans to implement
- Type
- Error
(inner) textAlignFull()
Aligns text along the left margin.
no plans to implement
- Type
- Error
(inner) textAlignLeft()
Aligns text along the left margin.
no plans to implement
- Type
- Error
(inner) textAlignNone()
Reverses the previously specified alignment settings.
no plans to implement
- Type
- Error
(inner) textAlignRight()
Aligns text along the right margin.
no plans to implement
- Type
- Error
(inner) textBold()
Makes the selected and subsequently entered text bold. This command is a toggle; selecting it again removes the bold.
no plans to implement
- Type
- Error
(inner) textBullet()
Applies the bullet attribute to selected and subsequently entered text.
no plans to implement
- Type
- Error
(inner) textCycleSpacing()
Resets the interline spacing below the selected text to single, one and a half, or double.
no plans to implement
- Type
- Error
(inner) textEnlargeFont()
Increases selected and subsequently entered text to the next larger point size.
no plans to implement
- Type
- Error
(inner) textFont()
Displays the Properties box for the current text, where the user can select the typeface, size, color, and style attributes.
no plans to implement
- Type
- Error
(inner) textItalic()
Italicizes the selected and subsequently entered text. This command is a toggle; selecting it a second time removes the italics.
no plans to implement
- Type
- Error
(inner) textJoin(delimiter, ignore_empty, …args) → {string}
Combines the text from multiple ranges and/or strings.
Name | Type | Attributes | Description |
---|---|---|---|
delimiter | * | A text string, either empty, or one or more characters enclosed by double quotes, or a reference to a valid text string. If a number is supplied, it will be treated as text. | |
ignore_empty | boolean | If TRUE, ignores empty values. | |
args | Array.<string> | <repeatable> | Text item to be joined. A text string, or array of strings, such as a range of values. |
- See
- For further information, see support.microsoft.com
The string containing the joined text.
- Type:
- string
rosettajs.Text.textJoin(" ",TRUE, "The", "sun", "will", "come", "up", "tomorrow."); // Returns "The sun will come up tomorrow."
(inner) textNormal()
Removes all style attributes from selected and subsequently entered text.
no plans to implement
- Type
- Error
(inner) textNumbers()
Applies the numbers attribute to selected and subsequently entered text.
no plans to implement
- Type
- Error
(inner) textOutdent()
Outdents selected and subsequently entered text by narrowing its left margin.
no plans to implement
- Type
- Error
(inner) textParagraph()
Displays the Paragraph Alignment panel of the Text Properties box.
no plans to implement
- Type
- Error
(inner) textParagraphStyles()
Displays the Paragraph Styles panel of the Text Properties box.
no plans to implement
- Type
- Error
(inner) textPermanentPen()
Toggles the permanent pen.
no plans to implement
- Type
- Error
(inner) textReduceFont()
Decreases the selected text to the next smaller point size.
no plans to implement
- Type
- Error
(inner) textSetFontColor()
Displays selected or subsequently entered text using the specified color.
no plans to implement
- Type
- Error
(inner) textSetFontFace()
Displays selected or subsequently entered text using the specified typeface.
no plans to implement
- Type
- Error
(inner) textSetFontSize()
Displays text using the specified point size.
no plans to implement
- Type
- Error
(inner) textSpacingDouble()
Sets Interline spacing below the selected text to double.
no plans to implement
- Type
- Error
(inner) textSpacingOneAndAHalf()
Sets interline spacing below the selected text to one and a half.
no plans to implement
- Type
- Error
(inner) textSpacingSingle()
Sets interline spacing below the selected text to single.
no plans to implement
- Type
- Error
(inner) textToNumber(text) → {NumberOrNumberList}
Converts a text string to a number, where possible.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string you want to convert to a number. If the string contains both numbers and letters, it must begin with a number to be converted properly. For example, the string "12ABC" converts to 12, but "ABC12" produces an error. |
- See
- For further information, see www.hcltechsw.com
The string, converted to a number.
- Type:
- NumberOrNumberList
rosettajs.Text.textToNumber('2500'); // returns 2500
rosettajs.Text.textToNumber('2500-xyz', '250.5abc', '333'); // returns [2500, 250.5, 333]
(inner) textUnderline()
Underlines selected and subsequently entered text. This command is a toggle; selecting it a second time removes the underlining.
no plans to implement
- Type
- Error
(inner) toNumber(value)
Converts a value to a number.
Name | Type | Description |
---|---|---|
value | string | | Text, number, or list thereof. A value that cannot be converted returns the error, "The value cannot be converted to a Number." |
- See
- For further information, see www.hcltechsw.com
Number or number list. The value converted to a number.
rosettajs.Text.toNumber('2500'); // returns 2500
"rosettajs.Text.toNumber('2500', '250.5', '333'); // returns [2500, 250.5, 333]
(inner) toTime(time_text) → {DateOrDateList}
Converts a value with a data type of text or time to a date-time value.
Name | Type | Description |
---|---|---|
time_text | DateOrDateList | The value to convert. A value that cannot be converted returns the error, "The value cannot be converted to a Number." |
- See
- For further information, see www.hcltechsw.com
The value converted to a date object.
- Type:
- DateOrDateList
// Returns Date values [02/29/2008, 03/01/2008]
rosettajs.Text.toTime(["2/29/08", "3/1/08"]);
// Return Date with value returns 08/31/2021
rosettajs.Text.adjust(rosettajs.Text.toTime("08/29/21"),0,0,2,0,0,0);
(inner) trim(text) → {TextOrTextList}
Removes leading, trailing, and redundant spaces from a text string, or from each element of a text list.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The text to trim. |
- See
- For further information, see www.hcltechsw.com and docs.oasis-open.org
The string, with extra spaces removed. and docs.oasis-open.org
- Type:
- TextOrTextList
rosettajs.trim(' more spaces '); // returns 'more spaces'
rosettajs.trim(' more spaces ',' less spaces '); // returns ['more spaces', 'less spaces']
(inner) unichar(number) → {string}
Returns the character specified by the code number.
Name | Type | Description |
---|---|---|
number | number | A number between 1 and 255 specifying which character you want. The character is from the character set used by your computer. Note: Excel for the web supports only CHAR(9), CHAR(10), CHAR(13), and CHAR(32) and above. |
- See
- For further information, see docs.oasis-open.org
The character specified by the code number.
- Type:
- string
rosetta.Text.unichar(65); // Returns "A"
(inner) unicode(text) → {number}
Returns a numeric code for the first character in a text string.
Name | Type | Description |
---|---|---|
text | string | The text for which you want the code of the first character. |
- See
- For further information, see docs.oasis-open.org
The character code for the first character in text.
- Type:
- number
rosetta.Text.unicode("A"); // Return 65
(inner) upper(text) → {string}
Converts text to uppercase.
Name | Type | Description |
---|---|---|
text | string | The text you want converted to uppercase. Text can be a reference or text string. |
- See
- For further information, see docs.oasis-open.org
The text converted to uppercase.
- Type:
- string
rosetta.Text.upper("Habc7"); // Returns "HABC7"
(inner) upperCase(text) → {TextOrTextList}
Converts the lowercase letters in the specified string to uppercase.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string you want to convert to uppercase. |
- See
- For further information, see www.hcltechsw.com
The string, converted to uppercase letters.
- Type:
- TextOrTextList
rosettajs.Text.upperCase('to upper case please'); // returns 'TO UPPER CASE PLEASE'
rosettajs.Text.upperCase('ABcd', 'efGH'); // returns ['ABCD', 'EFGH']
(inner) value(text)
Converts a text argument to a number.
Name | Type | Description |
---|---|---|
text | string | The text enclosed in quotation marks or a reference to a value containing the text you want to convert. |
- See
- For further information, see docs.oasis-open.org
The number represented by the text.
rosetta.Text.value("6"); // Returns 6
rosetta.Text.value("1E5"); // Returns 100000. Works with exponential notation.
rosetta.Text.value("7.25"); // Returns 7.25. Works with fractions.
rosetta.Text.value("50%"); // Returns 0.5. Works with percentages.
(inner) wide(text) → {TextOrTextList}
Converts half-pitch alphanumeric characters (single-byte characters -- SBCS) in the specified string to full-pitch alphanumeric characters (double-byte characters -- DBCS). This function works in Japanese, Korean, Simplified Chinese, and traditional Chinese environments. In the Japanese environment, this function can convert half-pitch Katakana as well.
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string you want to convert to double-byte characters. |
- See
- For further information, see www.hcltechsw.com
The string converted to double-byte characters.
- Type:
- TextOrTextList
rosettajs.Text.wide("0123456789ABCDEFGHI"); // returns "0123456789ABCDEFGHI"
rosettajs.Text.wide(["0123456789ABCDEFGHI", "アイウABCエオカᄀᄁᆪ"]); // returns ["0123456789ABCDEFGHI", "アイウABCエオカㄱㄲㄳ"]
(inner) word(text, separator, number) → {TextOrTextList}
Returns the specified word from a text string. A "word" is defined as the part of a string that is delimited by the defined separator character. For example, if you specify a space (" ") as the separator, then a word is any series of characters preceded by and followed by a space (or the beginning or end of the string).
Name | Type | Description |
---|---|---|
text | TextOrTextList | The string you want to scan. |
separator | string | The character that you want used to delimit a word in the string. |
number | number | A position indicating which word you want returned from string. A positive number refers to the position of the word starting from the beginning where 1 is the first word. A negative number refers to the position of the word starting from the end where -1 is the last word. |
- See
- For further information, see www.hcltechsw.com
The word that holds the position specified by the number in the string; for example, if number is 3, returns the third word in the string. If a text list is used, returns (in list format) a word from each list that holds the specified position. Returns an empty string if number is out of range, except that 0 is equivalent to 1.
- Type:
- TextOrTextList
rosettajs.Text.word("Larson, Collins, and Jensen", " ", 2); // Returns "Collins,"
rosettajs.Text.word("Larson,James,M.", ",", 3); // Returns "M."