Readonly
BASE64_Used with base64 methods to specify how bytes are encode to Base64. This is the default encoding.See [[B.fromBase64]], [[B.toBase64]]
Readonly
BASE64_Used with base64 methods to specify how bytes are encode to Base64. This is used to encode a url parameter. See RFC 4648. See [[B.fromBaseUrl64]], [[B.toBaseUrl64]]
A [[Java.ChoiceFormat]] based on the format string
Optional
zone: ZoneIdA [[Java.ChoiceFormat]] based on limits and formats
Optional
zone: ZoneIdThe csv functions are used to read data in a "comma separated values" format (CSV) or other related format such as tab delimited values. These data formats are used to represent data in rows and columns such as a spread sheet or a single database table. See [[CSV]] for more details.
Input to be parsed.
Assume a CSV file exported from a spreadsheet like this one:
First | Last | Birthday |
Betsy | Ross | 01 - Jan - 1735 |
Alexander | Hamilton | 11 - Jan - 1755 |
Benjamin | Franklin | 17 - Jan - 1706 |
Daniel | Webster | 18 - Jan - 1782 |
const fetcher = B.net.fetch("http://somedomain.com/birthdays.csv");
const out = "<ul>";
B.text.csv(fetcher, fetcher.charset)
.forEach(row => {
out += "<li>" + row[0] + " " + row[1] + ": " + row[2] + "</li>";
});
out += "</ul>";
inputStream.close();
The out variable now contains an HTML snippet that looks like this:
A field delimeter and text delimeter can also be specifed for other types of files. For example a tab delimeted file:
B.text.csv(tsvText)
.fieldDelimeter('\n') //default but specified here as an example
.textDelimeter('\t');
.forEach(row => {
//process row
});
A [[Java.DecimalFormat]] based on the format string
How to format the number
Used to find the difference between two strings and highlights those differences. See [[DiffBuilder]] and [[Diff]] for details.
const diff = B.text.diff('sample','s@mple')
.sensitivity(0.5)
.noLineDiff()
.sample(0)
.find();
const originalDifferences = diff.originalDiff;
const originalMatchedPercent = diff.originalMatchedPercent;
const currentDifferences = diff.currentDiff;
const currentMatchedPercent = diff.currentMatchedPercent;
const matchCharCount = diff.matchCharCount;
const original = diff.original;
const current = diff.current;
Returns a string of escaped HTML.
Returns a string that can be used inside Javascript quotes.
Returns a strings that can be used inside a JavaScript which is inside a tag attribute.
Decodes a string formatted as Base64 using [[BASE64_URL_DICT]] to a [[Java.ByteArray]]
Generates a random string of the specified length. You may optionally pass a string of characters to use as the source of
characters in the the random string, however the default is to use the full set of alphanumeric characters.
Throws IllegalArgumentException if the chars
string length is not between 1 and 256
Optional
chars: stringCharacters to use in the random string. Length must be between 1 and 256. Default is "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
Convert a string formatted as a hex string to a [[Java.ByteArray]]
Converts JSON to an XML string. The images of this method and its' sister method lie in one another's pre-image. Which is to say, for all valid XML strings A, and all xml-representative JSON B:
// both of these statements are true
xmlToJson(jsonToXml(xmlToJson(A))) == xmlToJson(A)
jsonToXml(xmlToJson(jsonToXml(B))) == jsonToXml(B)
Value representing text as JSON.
A [[Java.MessageFormat]] based on the format string
String to be formatted
Optional
zone: ZoneIdIf absent use the user's time zone to be used by formatter
const planet = 7;
const event = "a disturbance in the Force";
const messageFormat = B.text.messageFormat(
"At {1,time} on {1,date}, there was {2} on planet {0,number,integer} planet");
const result = messageFormat.format(new Date().getMilliseconds(), event);
The value of
result
is:At 12:30 PM on Jul 3, 2020, there was a disturbance in the Force on planet 7
Using an embedded [[Java.ChoiceFormat]] as a pattern:
const fileCount = 1273;
const diskName = "Disk A";
const messageFormat = B.text.messageFormat(
"The disk \"{1}\" contains {0,choice,0#no files|1#one file|1<{0,number,integer} files");
const result = messageFormat.format(fileCount, diskName);
The value of
result
for different values offileCount
is:The disk "Disk A" contains no files
The disk "Disk A" contains one file
The disk "Disk A" contains 1273 files
This method is for backwards compatiblity. It uses SHA1 algorithm and a server provided salt to create the hash. The purpose of this method is to determine if data has changed.
For instance, imagine a form with ten fields. Let's imagine
that four of the fields are critical and the remaining six are
less important. What if someone wanted to be notified when any
of the four critical fields change, but doesn't want to be bothered
when a change only effects the six less important fields. How can
the changed fields be identified, since Relate does not provide any
way of knowing? The answer is the secureHash()
function.
Here is how it is done: First, create another text field on the
form and use the "Field Locking and Hiding" features to make it
hidden on the form. Then write a formula that combines the values
from each of the four critical fields into a single large String
value. Since any type of data can be converted to a String this
will work with any type of field. Have the formula compute a
secureHash()
from the combined values and store it into the new
hidden text field. Now, whenever the form is saved, the formula
can re-compute the combined String value and the secure hash value
and, before storing the new result into the text field, the formula
can compare the new hash to the previous hash. If the hash values
are different then the formula should send the notification. If
they are the same, then none of the critical fields have been changed.
See also [[hash]].
Convert a string to a [[Java.ByteArray]]
Optional
charset: stringConverts a [[Java.ByteArray]] to a Base64 encode string using [[BASE64_URL_DICT]].
Makes a copy of a string value converting it from plain text to formatted HTML
Makes a copy of a string value, converting it from formatted HTML to plain text
This method makes a copy of a string value, attempting to capitalize it as it would be if it were the title of something
Validates an XML string against an XSD schema. Returns true
if the XML doc validates, returns false
otherwise.
A string representation of an XML document
A string representation of an XSD schema
Validates an XML string against an XSD schema. Returns true
if the XML doc validates, returns false
otherwise.
An InputStream representation of an XML document
An InputStream representation of an XSD schema
Validates an XML string against an XSD schema. Returns true
if the XML doc validates, returns false
otherwise.
Converts an XML string to JSON. The images of this method and its' sister method lie in one another's pre-image. Which is to say, for all valid XML strings A, and all xml-representative JSON B:
// both of these statements are true
xmlToJson(jsonToXml(xmlToJson(A))) == xmlToJson(A)
jsonToXml(xmlToJson(jsonToXml(B))) == jsonToXml(B)
Value representing text as XML.
TODO
Example