Viewed 2k times. Improve this question. It doesn't take effect as well. Add a comment. Active Oldest Votes. Improve this answer. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
Unsupported web browser - Use a modern browser to view this website! Bookmarks: Alpha. Previous Next. Overview What is FreeMarker? Download Version history About us License. Handy stuff Try template online Expressions cheatsheet directives? Decimal values will be truncated to integers. If the 1st parameter does not occur as a substring in this string starting from the given index, if you use the second parameter , then it returns Escapes the string with the escaping rules of Java language string literals, so it's safe to insert the value into a string literal.
Note that it will not add quotation marks around the inserted value; you meant to use this inside the string literal. All characters under UCS code point 0x20 will be escaped. Escapes the string with the escaping rules of JavaScript language string literals, so it's safe to insert the value into a string literal. Escapes the string with the escaping rules of JSON language string literals, so it's safe to insert the value into a string literal.
This will not escape ' characters, since JSON strings must be quoted with ". Removes the part of the string that is not after the first occurrence of the given substring. If the parameter string is not found, it will return an empty string. If the parameter string is a 0-length string, it will return the original string unchanged. This method accepts an optional flags parameter , as its 2nd parameter:. If the parameter string is not found, it will return the original string unchanged.
If the parameter string is a 0-length string, it will return an empty string. Returns the index within this string of the last rightmost occurrence of the specified substring. It returns the index of the first leftmost character of the substring. For example: "abcabc"? Also, you can specify the index to start the search from. Note that the second parameter indicates the maximum index of the start of the substring. Decimal values will be truncated to inegers. If the 1st parameter does not occur as a substring in this string before the given index, if you use the second parameter , then it returns If it's used with 1 parameter, then it inserts spaces on the beginning of the string until it reaches the length that is specified as the parameter.
If the string is already as long or longer than the specified length, then it does nothing. For example, this:.
If it's used with 2 parameters, then the 1st parameter means the same as if you were using the built-in with only 1 parameter, and the second parameter specifies what to insert instead of space characters. The 2nd parameter can be a string whose length is greater than 1.
Then the string will be inserted periodically, for example:. The lower case version of the string. This is a "power user" built-in. Ignore it if you don't know regular expressions. This built-in determines if the string exactly matches the pattern. Also, it returns the list of matching sub-strings. The return value is a multi-type value:. Boolean: true , if it the entire string matches the pattern, otherwise false.
For example, "fooo"? Sequence: the list of matched substrings of the string. Possibly a 0 length sequence. If the regular expression contains groups parentheses , then you can access them with the groups built-in:. It works both with substring matches and with the result of entire string matching as it was shown in the above example. The first item in the sequence that groups returns is the whole substring matched by the regular expression.
Hence, the index of the first explicit regular expression group with other words, of the first Also, because of this, the size of the sequence is one more than the number of explicit regular expression groups. The size of the sequence returned by groups only depends on the number of explicit groups in the regular expression, and so it will be the same non-0 even if there was no match found for the regular expression. Attempting to access an item of the sequence as in res?
When there's a match for the regular expression, but not for a certain explicit group inside the regular expression, then for that group the sequence will contain a 0 length string. So accessing a group that matches nothing is safe, as far as the containing regular expression has matched something.
Note that it doesn't support flag f , and ignores the r flag. Prevents the auto-escaping of a value. This works by converting the string value to a markup output value , which uses the string as the markup as is, and belongs to the current output format at the point of the invocation. This built-in can also be applied on markup output values, which it will bypass without change, as far as the input markup output value belongs to current output format. The string converted to numerical value.
The number must be in "computer language" format. That is, it must be in the locale independent form, where the decimal separator is dot, and there's no grouping. This built-in recognizes numbers in the format that the FreeMarker template language uses. In additionally, it recognizes scientific notation e. Since FreeMarker 2. However, that method should behave similarly as described above.
It is used to replace all occurrences of a string in the original string with another string. It does not deal with word boundaries. If the 1st parameter is an empty string, then all occurrences of the empty string will be replaced, like "foo"? Removes the parameter substring from the beginning of the string, or returns the original string if it doesn't start with the parameter substring.
Removes the parameter substring from the ending of the string, or returns the original string if it doesn't end with the parameter substring. To help migration, this built-in silently bypasses RTF markup output values without changing them. It is used to split a string into a sequence of strings along the occurrences of another string.
Note that it is assumed that all occurrences of the separator is before a new item except with "r" flag - see later , thus:.
0コメント