public static NodeValue strAfter(NodeValue string, NodeValue match) { checkTwoArgumentStringLiterals("strAfter", string, match) ; String lex1 = string.asNode().getLiteralLexicalForm() ; String lex2 = match.asNode().getLiteralLexicalForm() ; Node mainArg = string.asNode() ; if ( lex2.length() == 0 ) return calcReturn(lex1, mainArg) ; int i = lex1.indexOf(lex2) ; if ( i < 0 ) return NodeValue.nvEmptyString ; i += lex2.length() ; String s = lex1.substring(i) ; return calcReturn(s, string.asNode()) ; }
public static NodeValue strStartsWith(NodeValue string, NodeValue match) { checkTwoArgumentStringLiterals("strStarts", string, match) ; String lex1 = string.asNode().getLiteralLexicalForm() ; String lex2 = match.asNode().getLiteralLexicalForm() ; return NodeValue.booleanReturn(lex1.startsWith(lex2)) ; }
public static NodeValue strEndsWith(NodeValue string, NodeValue match) { checkTwoArgumentStringLiterals("strEnds", string, match) ; String lex1 = string.asNode().getLiteralLexicalForm() ; String lex2 = match.asNode().getLiteralLexicalForm() ; return NodeValue.booleanReturn(lex1.endsWith(lex2)) ; }
public static NodeValue strBefore(NodeValue string, NodeValue match) { checkTwoArgumentStringLiterals("strBefore", string, match) ; String lex1 = string.asNode().getLiteralLexicalForm() ; String lex2 = match.asNode().getLiteralLexicalForm() ; Node mainArg = string.asNode() ; if ( lex2.length() == 0 ) return calcReturn("", mainArg) ; int i = lex1.indexOf(lex2) ; if ( i < 0 ) return NodeValue.nvEmptyString ; String s = lex1.substring(0, i) ; return calcReturn(s, string.asNode()) ; }
public static NodeValue strContains(NodeValue string, NodeValue match) { checkTwoArgumentStringLiterals("contains", string, match) ; String lex1 = string.asNode().getLiteralLexicalForm() ; String lex2 = match.asNode().getLiteralLexicalForm() ; boolean x = StrUtils.contains(lex1, lex2) ; return NodeValue.booleanReturn(x) ; }