FormatHelper SFO
Properties
Field | Type | Comment/Sample |
---|
Methods
Method | Returns | Parameters | Parameter Types | Comments/Sample |
---|---|---|---|---|
|
|
| parses a string by csv and returns back an array. | |
|
|
|
| returns true if text contains search within it |
|
| creates a copy of an array and returns it | ||
|
|
|
| checks to see if address matches any of the ip addresses in the matchAddresses array and returns true if a match is made |
|
|
|
| returns true if the two strings match in a case-insensitive manner |
|
|
|
| escapes a string of html |
|
|
|
| escapes a string of javascript |
exerpt(input, maxLength) | string |
|
| takes a chuck of text and returns back the first maxLength characters of it. |
exerptSentence(input, maxLength) | string |
|
| takes a chuck of text and returns back the first maxLength characters of it. If the chunk contains a period, The routine finds the last period within the excerpt and returns everything up to and including that period. This allows for excerpts that are whole sentences. |
|
|
|
| returns back an except from a block of xhtml |
excerptXhtml(xhtml, maxLength, finishSentence) | string | xhtml maxLength finishSentence | string | returns back an except from a block of xhtml, but it will finish out the sentence so that there is not an odd break. |
|
|
| filters a collection and removes any members that do not have a matching attribute name/value pair. The last parameter flips this behavior by removing any matches | |
|
|
| loops through a collection and removes any items that do not have an ebay auction id associated with it. | |
|
|
| loops through a collection of product groups and removes any that does not have at least one item assigned to it | |
|
|
|
| examines a string and returns the characters preceeding the first newline |
formatDate(timestamp, format, timezone) | string |
|
| This method is useful for formatting raw timestamp objects into strings. As a reminder, the UltraCart platform is java based, and this method uses the SimpleDateFormat object underneath. So the format and timezone strings should be based on that object's requirements. See the official SimpleDateFormat docs for example formats and timezones.
|
|
|
|
| returns the object found at the index position of the objects array. |
|
| takes an array of items and returns back a slice to help with pagination | ||
|
|
| returns the count of items. objects.size() will do the same thing. | |
|
|
|
| returns the number of words in a string |
|
|
|
| takes a string and returns a valid string for an html id. Strips out invalid characters. |
|
|
|
| returns the index of search if it is found in text, or -1 otherwise |
|
|
|
| injects the string variable 'inject' after the nth occurrence of the search variable. |
|
|
|
| true if the value converts to a number that is between d1 and d2. |
|
|
|
| |
|
|
|
| returns true if the string is not null |
|
|
| parses an object and returns back a BigDecimal | |
|
|
|
| parses a string and returns an integer |
|
|
|
| returns a random object from an array |
|
|
|
| returns n count of random objects from an array |
| integer | nun | integer | |
|
|
|
| strips html from a string |
|
| removes all items from an array which are free | ||
|
|
|
| converts all newlines to a single space each |
|
| removes all items from an array which are out of stock | ||
|
| removes all items from an array which are out of stock and not preorder nor backorder | ||
|
|
|
| converts newlines to <br> tags. Useful for displaying long item descriptions or terms and conditions in a nicely formatted paragraph. |
|
|
|
| does a search and replace on a string |
|
|
| reverses a collection based on ordinal position | |
|
|
|
| removes newlines from a string |
|
| sorts a collection of items by a list of sort values (i.e. Small, Medium, Large, X-Large, etc) | ||
|
|
|
| sorts a collection of attributes by name. There are many different types of attributes: product group attributes, item attributes, and affiliate attributes. This method handles them all. |
|
| sorts a collection of items by looking at the item attributes and sorting by attribute specified by the 2nd parameter. ascending is an optional value used to switch the sorting direction. | ||
|
| sorts a collection of items by looking at the item attributes and sorting by the attribute list specified by the 2nd parameter. ascending is an optional value used to switch the sorting direction for each attribute. | ||
|
|
|
| sorts an array of strings |
|
| sorts a collection of items by item id. | ||
|
| sorts a collection of items. ascending is a an optional parameter that can be used to sort high-low if desired. | ||
|
| sorts a collection of items by review stars. ascending is a an optional parameter that can be used to sort high-low if desired. | ||
|
|
|
| compares the two values. Returns back -1 if av1 is less than. Returns back 1 if av2 is less than, and returns zero if they're equal. av1 and av2 may also be integers |
|
|
|
| sorts an array of reviews based on the sortOn fields. Valid values for sortOn are "featured", "date", "rating", "helpfulness", "length", "reviewRank", "expert" |
|
|
|
| converts a string to lower case |
|
|
|
| converts a string to upper case |
|
|
|
| trims a string if it exceeds 'len' |
|
|
|
| url decodes a string |
|
|
|
| url encodes a string |