Package astra.lang

Class Strings


  • public class Strings
    extends Module
    This API provides support for manipulating strings in ASTRA.
    Author:
    Rem Collier
    • Constructor Detail

      • Strings

        public Strings()
    • Method Detail

      • equal

        public Formula equal​(String source,
                             String target)
        Formula that checks if the two strings are equals.
        Parameters:
        source - one string
        target - the other string
        Returns:
        the formula TRUE if the strings are equal, the formula FALSE otherwise
      • startsWith

        public Formula startsWith​(String text,
                                  String pattern)
        Formula that checks if the text starts with the pattern.
        Parameters:
        text - the text
        pattern - the pattern
        Returns:
        the formula TRUE if the strings are equal, the formula FALSE otherwise
      • endsWith

        public Formula endsWith​(String text,
                                String pattern)
        Formula that checks if the text ends with the pattern.
        Parameters:
        text - the text
        pattern - the pattern
        Returns:
        the formula TRUE if the strings are equal, the formula FALSE otherwise
      • charAt

        public char charAt​(String source,
                           int index)
        Term that returns the character at the given index in the source string.
        Parameters:
        source - the string
        index - the index of the character in the string
        Returns:
        the character at the given index in the string
      • split

        public ListTerm split​(String source,
                              String delimiter)
        Term that splits the string into an ASTRA list of tokens separated by the given delimiter.
        Parameters:
        source - the source string
        delimiter - the delimiter
        Returns:
        a list of strings