or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

arrays.mdassertions.mdcore.mddom.mdevents.mdindex.mdmath.mdobjects.mdstrings.md
tile.json

strings.mddocs/

String Processing

Extensive string utilities for testing, transformation, case conversion, manipulation, comparison, and escaping operations with comprehensive string processing capabilities.

Capabilities

String Testing

Functions for testing string properties and characteristics.

/**
 * Tests if string is empty or contains only whitespace
 * @param {string} str - String to test
 * @return {boolean} True if empty or whitespace only
 */
goog.string.isEmptyOrWhitespace = function(str) {};

/**
 * Tests if string is empty
 * @param {string} str - String to test
 * @return {boolean} True if empty string
 */
goog.string.isEmptyString = function(str) {};

/**
 * Tests if string is empty (alias for isEmptyString)
 * @param {string} str - String to test
 * @return {boolean} True if empty
 */
goog.string.isEmpty = function(str) {};

/**
 * Tests if string is breaking whitespace
 * @param {string} str - String to test
 * @return {boolean} True if breaking whitespace
 */
goog.string.isBreakingWhitespace = function(str) {};

/**
 * Tests if string contains only alphabetic characters
 * @param {string} str - String to test
 * @return {boolean} True if alphabetic
 */
goog.string.isAlpha = function(str) {};

/**
 * Tests if string contains only numeric characters
 * @param {string} str - String to test
 * @return {boolean} True if numeric
 */
goog.string.isNumeric = function(str) {};

/**
 * Tests if string contains only alphanumeric characters
 * @param {string} str - String to test
 * @return {boolean} True if alphanumeric
 */
goog.string.isAlphaNumeric = function(str) {};

/**
 * Tests if character is a space
 * @param {string} ch - Character to test
 * @return {boolean} True if space character
 */
goog.string.isSpace = function(ch) {};

/**
 * Tests if string is a single unicode character
 * @param {string} str - String to test
 * @return {boolean} True if unicode character
 */
goog.string.isUnicodeChar = function(str) {};

/**
 * Tests if string starts with prefix
 * @param {string} str - String to test
 * @param {string} prefix - Prefix to check for
 * @return {boolean} True if starts with prefix
 */
goog.string.startsWith = function(str, prefix) {};

/**
 * Tests if string ends with suffix
 * @param {string} str - String to test
 * @param {string} suffix - Suffix to check for
 * @return {boolean} True if ends with suffix
 */
goog.string.endsWith = function(str, suffix) {};

/**
 * Case-insensitive test if string starts with prefix
 * @param {string} str - String to test
 * @param {string} prefix - Prefix to check for
 * @return {boolean} True if starts with prefix (case-insensitive)
 */
goog.string.caseInsensitiveStartsWith = function(str, prefix) {};

/**
 * Case-insensitive test if string ends with suffix
 * @param {string} str - String to test
 * @param {string} suffix - Suffix to check for
 * @return {boolean} True if ends with suffix (case-insensitive)
 */
goog.string.caseInsensitiveEndsWith = function(str, suffix) {};

String Transformation

Functions for transforming and cleaning strings.

/**
 * Removes newline characters from string
 * @param {string} str - String to process
 * @return {string} String without newlines
 */
goog.string.stripNewlines = function(str) {};

/**
 * Removes quotes from beginning and end of string
 * @param {string} str - String to process
 * @param {string} quoteChars - Quote characters to remove
 * @return {string} String without surrounding quotes
 */
goog.string.stripQuotes = function(str, quoteChars) {};

/**
 * Trims whitespace from both ends of string
 * @param {string} str - String to trim
 * @return {string} Trimmed string
 */
goog.string.trim = function(str) {};

/**
 * Trims whitespace from left end of string
 * @param {string} str - String to trim
 * @return {string} Left-trimmed string
 */
goog.string.trimLeft = function(str) {};

/**
 * Trims whitespace from right end of string
 * @param {string} str - String to trim
 * @return {string} Right-trimmed string
 */
goog.string.trimRight = function(str) {};

/**
 * Collapses consecutive whitespace into single spaces
 * @param {string} str - String to process
 * @return {string} String with collapsed whitespace
 */
goog.string.collapseWhitespace = function(str) {};

/**
 * Normalizes whitespace characters
 * @param {string} str - String to normalize
 * @return {string} String with normalized whitespace
 */
goog.string.normalizeWhitespace = function(str) {};

/**
 * Normalizes spaces in string
 * @param {string} str - String to normalize
 * @return {string} String with normalized spaces
 */
goog.string.normalizeSpaces = function(str) {};

/**
 * Canonicalizes newlines to consistent format
 * @param {string} str - String to process
 * @return {string} String with canonical newlines
 */
goog.string.canonicalizeNewlines = function(str) {};

Case Conversion

Functions for converting string case formats.

/**
 * Converts string to title case
 * @param {string} str - String to convert
 * @param {string=} opt_delimiters - Word delimiter characters
 * @return {string} Title case string
 */
goog.string.toTitleCase = function(str, opt_delimiters) {};

/**
 * Converts string to camel case
 * @param {string} str - String to convert
 * @return {string} Camel case string
 */
goog.string.toCamelCase = function(str) {};

/**
 * Converts string to selector case (kebab-case)
 * @param {string} str - String to convert
 * @return {string} Selector case string
 */
goog.string.toSelectorCase = function(str) {};

/**
 * Capitalizes first letter of string
 * @param {string} str - String to capitalize
 * @return {string} Capitalized string
 */
goog.string.capitalize = function(str) {};

/**
 * Tests if string is lower camel case format
 * @param {string} str - String to test
 * @return {boolean} True if lower camel case
 */
goog.string.isLowerCamelCase = function(str) {};

/**
 * Tests if string is upper camel case format
 * @param {string} str - String to test
 * @return {boolean} True if upper camel case
 */
goog.string.isUpperCamelCase = function(str) {};

String Manipulation

Functions for manipulating and building strings.

/**
 * Repeats string specified number of times
 * @param {string} string - String to repeat
 * @param {number} length - Number of repetitions
 * @return {string} Repeated string
 */
goog.string.repeat = function(string, length) {};

/**
 * Pads number with leading zeros
 * @param {number} num - Number to pad
 * @param {number} length - Target length
 * @param {number=} opt_precision - Decimal precision
 * @return {string} Padded number string
 */
goog.string.padNumber = function(num, length, opt_precision) {};

/**
 * Makes object safe to convert to string
 * @param {*} obj - Object to make safe
 * @return {string} Safe string representation
 */
goog.string.makeSafe = function(obj) {};

/**
 * Builds string from multiple arguments
 * @param {...*} var_args - Arguments to concatenate
 * @return {string} Built string
 */
goog.string.buildString = function(var_args) {};

/**
 * Removes substring at specific index
 * @param {string} s - Source string
 * @param {number} index - Starting index
 * @param {number} stringLength - Length to remove
 * @return {string} String with substring removed
 */
goog.string.removeAt = function(s, index, stringLength) {};

/**
 * Removes first occurrence of substring
 * @param {string} s - Source string
 * @param {string} ss - Substring to remove
 * @return {string} String with substring removed
 */
goog.string.remove = function(s, ss) {};

/**
 * Removes all occurrences of substring
 * @param {string} s - Source string
 * @param {string} ss - Substring to remove
 * @return {string} String with all occurrences removed
 */
goog.string.removeAll = function(s, ss) {};

/**
 * Splits string with maximum number of parts
 * @param {string} str - String to split
 * @param {string} separator - Separator string
 * @param {number} limit - Maximum number of parts
 * @return {Array<string>} Split string parts
 */
goog.string.splitLimit = function(str, separator, limit) {};

String Comparison

Functions for comparing strings with various options.

/**
 * Case-insensitive string comparison
 * @param {string} str1 - First string
 * @param {string} str2 - Second string
 * @return {number} -1, 0, or 1 for less, equal, greater
 */
goog.string.caseInsensitiveCompare = function(str1, str2) {};

/**
 * Case-insensitive equality comparison
 * @param {string} str1 - First string
 * @param {string} str2 - Second string
 * @return {boolean} True if equal (case-insensitive)
 */
goog.string.caseInsensitiveEquals = function(str1, str2) {};

/**
 * Case-insensitive substring search
 * @param {string} str - String to search in
 * @param {string} subString - Substring to find
 * @return {boolean} True if substring found (case-insensitive)
 */
goog.string.caseInsensitiveContains = function(str, subString) {};

/**
 * Counts occurrences of substring
 * @param {string} s - String to search in
 * @param {string} ss - Substring to count
 * @return {number} Number of occurrences
 */
goog.string.countOf = function(s, ss) {};

/**
 * Calculates edit distance between two strings
 * @param {string} a - First string
 * @param {string} b - Second string
 * @return {number} Edit distance
 */
goog.string.editDistance = function(a, b) {};

String Escaping & Encoding

Functions for escaping and encoding strings for various contexts.

/**
 * HTML escapes string for safe insertion into HTML
 * @param {string} str - String to escape
 * @param {boolean=} opt_isLikelyToContainHtmlChars - Optimization hint
 * @return {string} HTML-escaped string
 */
goog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) {};

/**
 * Unescapes HTML entities in string
 * @param {string} str - String with HTML entities
 * @return {string} Unescaped string
 */
goog.string.unescapeEntities = function(str) {};

/**
 * Escapes whitespace for display
 * @param {string} str - String to escape
 * @param {boolean=} opt_xml - Whether to use XML format
 * @return {string} Whitespace-escaped string
 */
goog.string.whitespaceEscape = function(str, opt_xml) {};

/**
 * Preserves spaces for HTML display
 * @param {string} str - String to process
 * @return {string} String with preserved spaces
 */
goog.string.preserveSpaces = function(str) {};

String Formatting & Utilities

Functions for formatting strings and utility operations.

/**
 * Substitutes placeholders in string template
 * @param {string} str - Template string with placeholders
 * @param {...*} var_args - Values to substitute
 * @return {string} String with substituted values
 */
goog.string.subs = function(str, var_args) {};

/**
 * Gets hash code for string
 * @param {string} str - String to hash
 * @return {number} Hash code
 */
goog.string.hashCode = function(str) {};

/**
 * Gets unique string counter value
 * @return {number} Unique counter value
 */
goog.string.uniqueStringCounter = function() {};

/**
 * Creates unique string identifier
 * @return {string} Unique string
 */
goog.string.createUniqueString = function() {};

/**
 * Converts string to number
 * @param {string} str - String to convert
 * @return {number} Converted number
 */
goog.string.toNumber = function(str) {};

/**
 * Removes file extension from filename
 * @param {string} filename - Filename to process
 * @return {string} Filename without extension
 */
goog.string.stripFileExtension = function(filename) {};

Usage Examples:

// String testing
var isEmpty = goog.string.isEmpty(''); // true
var startsWithHello = goog.string.startsWith('Hello World', 'Hello'); // true

// String transformation
var trimmed = goog.string.trim('  hello  '); // 'hello'
var camelCase = goog.string.toCamelCase('hello-world'); // 'helloWorld'

// String manipulation
var repeated = goog.string.repeat('abc', 3); // 'abcabcabc'
var substituted = goog.string.subs('Hello {0}!', 'World'); // 'Hello World!'

// String escaping
var escaped = goog.string.htmlEscape('<script>alert("xss")</script>');
// '&lt;script&gt;alert(&quot;xss&quot;)&lt;/script&gt;'

// String comparison
var distance = goog.string.editDistance('kitten', 'sitting'); // 3