A collection of utilities for manipulating strings.
To use the string builtin library,
require it with the alloy
root directory in your require
call. For example:
var string = require('alloy/string');
var text = ' hola, mundo ';
Ti.API.info(string.ucfirst(string.trim(text))); // --> 'Hola, mundo'
Returns an amount formatted as a currency value. Uses the device settings to determine the currency symbol. On the Mobile Web platform, the currency symbol will always be dollars ('$').
Amount to format.
Amount formatted as a currency value.
Lowercases the first character in the string.
String to lowercase.
String with first character lowercased.
Removes leading and trailing white space from a string.
String to trim.
String without leading and trailing white space.
Removes trailing zeroes from a float value after the decimal point.
Number to trim.
Number without trailing zeroes.
Capitalizes the first character in the string.
String to capitalize.
String with first character capitalized.
Converts URL-encoded characters in a string to ASCII characters. For example, the string '%38' will return '&'.
String to process.
String with URL-encoded characters replaced with ASCII characters.
Parses an URL and converts it to JSON-formatted data. For example, an URL with a query string will produce a JSON object with each query field paired with its value as well as the base URL.
URL to process.
JSON-formatted URL data.