Was this page helpful?

Wiki.AnyPage

    wiki.anypage(query : str, seconds : num? , max : num? , linkonly : bool?, titlestyle : str?) : xml
    

    Show the contents of a random page selected from the query's result set.

    Usage Restrictions

    1.8.2 or later

    Parameters

    Name Type Description
    query str The query string.
    seconds num (optional, default: 3600) Interval in seconds for selecting another page
    max num (optional, default: 100) Max query results
    linkonly bool (optional, default: false) link to the page
    titlestyle str (optional, default: "display: none;") Style for page title

    Result

    The query's result set in xml format

    Samples

      Output

    To find the query's result set:

    {{wiki.anypage("string") }} 

     

    String.matches()

    The behavior of string.matches() defies common sense.  It is possible that it is functioning as intended, but if so then I can't see what the intent actually is.  Examples:

    {{ string.matches("abcabc", "(abc)+") }} ==> [ "abcabc" ]

    Fine.  How about:

    {{ string.matches("abcxabc", "(abc)+") }} ==> [ "abc", "abc" ]

    Why does this not also return [ "abc", "abc" ]?

    Here's the example from the string.matches() doc page:

    {{ string.matches("aba cad abra", "(a|b|r)+") }} ==> [ "aba", "a", "abra" ]

    Why does this not return [ "a", "b", "a", "a", "a", "b", "r", "a" ]?

    How is this supposed to work?

    To find the query's result set:

    {{wiki.anypage("string", 5) }} 

     

    String.IsDigit
    String.IsDigit(str : str) : bool 

    Check if first character in string is a decimal digit.

    Usage Restrictions

    8.05.2b or later

    Parameters

    Name Type Description
    str string The string value.

            

    Result

    True if the first character in the string is a decimal digit.

    Samples

             Output

    Check if first character in string is a decimal digit:

    {{ String.IsDigit("1 cat") }} 

            

    true

    Check if first character in string is a decimal digit:

    {{ String.IsDigit("One cat") }} 

            

    false

            

    To find the query's result set:

    {{wiki.anypage("string", 5, 2) }} 

     

    String.Replace
    string.Replace(text : str, before : str, after : str, ignorecase : bool) : str

    Replaces all occurrences of a string with another string.

    Usage Restrictions

    1.9.1 or later

    9.02 or later for ignorecase argument

    Parameters

    Name Type Description
    text str The string value.
    before str The old value.
    after str The new value.
    ignorecase bool? ignore case (optional, default: false)

    Result

    The string value with the specified section(s) replaced with a new value.

    Samples

      Output

    To replace a string with another string:

    {{ string.replace("Hi Joe, joe", "Joe", "Moe") }} 

     

    Hi Moe, joe

    To replace a string with another string:

    {{ string.replace("Hi Joe, joe", "Joe", "Moe", true) }} 

    Hi Moe, Moe

    To find the query's result set:

    {{wiki.anypage("string", 5, 2, true) }} 

     

    String.Replace

     

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by