Java Code Examples for jdk.nashorn.internal.runtime.ScriptRuntime#isJSWhitespace()

The following examples show how to use jdk.nashorn.internal.runtime.ScriptRuntime#isJSWhitespace() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * ECMA 15.5.4.20 String.prototype.trim ( )
 * @param self self reference
 * @return string trimmed from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object trim(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }
    while (end > start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 2
/**
 * ECMA 15.5.4.20 String.prototype.trim ( )
 * @param self self reference
 * @return string trimmed from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trim(final Object self) {
    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }
    while (end > start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 3
/**
 * ECMA 15.5.4.20 String.prototype.trim ( )
 * @param self self reference
 * @return string trimmed from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trim(final Object self) {
    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }
    while (end > start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 4
/**
 * ECMA 15.5.4.20 String.prototype.trim ( )
 * @param self self reference
 * @return string trimmed from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trim(final Object self) {
    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }
    while (end > start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 5
/**
 * ECMA 15.5.4.20 String.prototype.trim ( )
 * @param self self reference
 * @return string trimmed from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trim(final Object self) {
    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }
    while (end > start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 6
/**
 * ECMA 15.5.4.20 String.prototype.trim ( )
 * @param self self reference
 * @return string trimmed from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object trim(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }
    while (end > start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 7
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object trimRight(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 8
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimRight(final Object self) {

    final String str = checkObjectToString(self);
    final int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 9
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimRight(final Object self) {

    final String str = checkObjectToString(self);
    final int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 10
/**
 * Nashorn extension: String.prototype.trimLeft ( )
 * @param self self reference
 * @return string trimmed left from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimLeft(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    final int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }

    return str.substring(start, end + 1);
}
 
Example 11
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimRight(final Object self) {

    final String str = checkObjectToString(self);
    final int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 12
/**
 * Nashorn extension: String.prototype.trimLeft ( )
 * @param self self reference
 * @return string trimmed left from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimLeft(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    final int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }

    return str.substring(start, end + 1);
}
 
Example 13
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimRight(final Object self) {

    final String str = checkObjectToString(self);
    final int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 14
/**
 * Nashorn extension: String.prototype.trimLeft ( )
 * @param self self reference
 * @return string trimmed left from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimLeft(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    final int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }

    return str.substring(start, end + 1);
}
 
Example 15
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimRight(final Object self) {

    final String str = checkObjectToString(self);
    final int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 16
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object trimRight(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 17
/**
 * Nashorn extension: String.prototype.trimRight ( )
 * @param self self reference
 * @return string trimmed right from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimRight(final Object self) {

    final String str = checkObjectToString(self);
    final int start = 0;
    int end   = str.length() - 1;

    while (end >= start && ScriptRuntime.isJSWhitespace(str.charAt(end))) {
        end--;
    }

    return str.substring(start, end + 1);
}
 
Example 18
/**
 * Nashorn extension: String.prototype.trimLeft ( )
 * @param self self reference
 * @return string trimmed left from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimLeft(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    final int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }

    return str.substring(start, end + 1);
}
 
Example 19
/**
 * Nashorn extension: String.prototype.trimLeft ( )
 * @param self self reference
 * @return string trimmed left from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static String trimLeft(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    final int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }

    return str.substring(start, end + 1);
}
 
Example 20
/**
 * Nashorn extension: String.prototype.trimLeft ( )
 * @param self self reference
 * @return string trimmed left from whitespace
 */
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object trimLeft(final Object self) {

    final String str = checkObjectToString(self);
    int start = 0;
    int end   = str.length() - 1;

    while (start <= end && ScriptRuntime.isJSWhitespace(str.charAt(start))) {
        start++;
    }

    return str.substring(start, end + 1);
}