Chaga Programming Language: Chapter 3

Functions and Procedures

  • Functions and procedures allow one to define a series of programming statements as a subroutine. This technique promotes modularity and reduces code duplication.
  • Functions and procedures are invoked from a calling program using the call statement.
  • Functions and procedures both acccept zero or more inputs parameters.
  • Functions return one or more parameters to the calling program using the return statement.
  • Procedures do not return a value to the calling program.

Chaga built-in functions and procedures

The Chaga programming language contains the following built-in functions and procedures:

CALL statement

Usage:

  • set identifier = call identifier (parameter list);

RETURN statement

Usage:

  • return (expression);

Example 1: Defining a function and a procedure.

define procedure fizzbuzz (int counter)
{
  declare int state;

  set state = 0;
  if ((counter % 3) == 0)
  {
    set state = 1;
  }
  if ((counter % 5) == 0)
  {
    set state = state * 2 + 2;
  }
  if (state == 1)
  {
    call print ("Fizz");
  }
  else
  {
    if (state == 2)
    {
      call print ("Buzz");
    }
    else
    {
      if (state == 4)
      {
        call print ("Fizzbuzz");
      }
      else
      {
        call print (counter);
      }
    }
  }
}


define function main (int argc, pointer argv) return (int)
{
  declare int counter;

  set counter = 1;
  while (counter <= 100)
  {
    call fizzbuzz (counter);
    set counter = counter + 1;
    if (counter <= 100)
    {
      call print (", ");
    }
    else
    {
      call print ("\n");
    }
  }
  return (0);
}

COMPLEX (datatype) processing functions and procedures

  • complex_set_real
  • complex_set_imaginary
  • complex_get_real
  • complex_get_imaginary

DATE (datatype) processing functions and procedures

DATE_ADD_DAY function

Returns the date denoted by output_date_identifier resulting from adding an input number of days denoted by input_int_datatype to the input date denoted by input_date_datatype.

Usage:

  • set output_date_identifier = call date_add_day ( input_date_identifier, input_int_identifier );

Jump to top

DATE_ADD_MONTH function

Returns the date denoted by output_date_identifier resulting from adding an input number of months denoted by input_int_datatype to the input date denoted by input_date_datatype.

Usage:

  • set output_date_identifier = call date_add_month ( input_date_identifier, input_int_identifier );

Jump to top

DATE_ADD_YEAR function

Returns the date denoted by output_date_identifier resulting from adding an input number of years denoted by input_int_datatype to the input date denoted by input_date_datatype.

Usage:

  • set output_date_identifier = call date_add_year ( input_date_identifier, input_int_identifier );

Jump to top

DATE_GET_DAY function

Returns the day from an input DATE datatype variable as an integer datatype.

Usage:

  • set int_identifier = call date_get_day (input_date_identifier);

Jump to top

DATE_GET_DAY_NAME function

Returns the day name (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) from an input DATE variable as a string datatype.

Usage:

  • set output_string_identifier = call date_get_weekday ( input_date_identifier );

Example: date_get_day_name

declare date d1;
declare string s1, day_name;

set s1 = "2026-11-26"; // string format for date is YYYY-MM-DD format.
set d1 = call string_to_date (s1);
day_name = call date_get_day_name (d1);
call print (day_of_week, "\n");

Output from date_get_day_name

Thursday

Jump to top

DATE_GET_MONTH function

Returns the month from an input DATE datatype variable as an integer (int datetype).

Usage:

  • set int_identifier = call date_get_month (input_date_identifier);

Jump to top

DATE_GET_MONTH_NAME function

Returns the name of the month (January, February, March, April, May, June, July, August, September, October, November, December) from an input DATE datatype variable as an integer (int datetype).

Usage:

  • set int_identifier = call date_get_month (input_date_identifier);

Jump to top

DATE_GET_YEAR function

Returns the four-digit year from an input DATE datatype variable as an integer (int datetype).

Usage:

  • set int_identifier = call date_get_year (input_date_identifier);

Jump to top

DATE_SET_CURRENT_DATE function

Returns the current date in YYYY-MM-DD format.

Usage:

  • set date_identifier = call date_set_current_date ();

Jump to top

DATE_SET_DAY procedure

Updates the day of an input DATE datatype denoted by input_date_datatype variable to the value denoted by input_integer_datatype. The input_integer_datatype must be a value between 1 and 31 inclusive.

Usage:

  • call date_set_day ( input_date_identifier, input_integer_datatype );

Jump to top

DATE_SET_MONTH procedure

Updates the month of an input DATE datatype denoted by input_date_datatype variable to the value denoted by input_integer_datatype. The input_integer_datatype must be a value between 1 and 12 inclusive.

Usage:

  • call date_set_month ( input_date_identifier, input_integer_datatype );

Jump to top

DATE_SET_YEAR procedure

Updates the year of an input DATE datatype denoted by input_date_datatype variable to the value denoted by input_integer_datatype.

Usage:

  • call date_set_year ( input_date_identifier, input_integer_datatype );

Jump to top

DATE_SUBTRACT_DAY function

Returns the date denoted by output_date_identifier resulting from subtracting an input number of days denoted by input_int_datatype to the input date denoted by input_date_datatype.

Usage:

  • set output_date_identifier = call date_subtract_day ( input_date_identifier, input_int_identifier );

Jump to top

DATE_SUBTRACT_MONTH function

Returns the date denoted by output_date_identifier resulting from subtracting an input number of months denoted by input_int_datatype to the input date denoted by input_date_datatype.

Usage:

  • set output_date_identifier = call date_subtract_month ( input_date_identifier, input_int_identifier );

Jump to top

DATE_SUBTRACT_YEAR function

Returns the date denoted by output_date_identifier resulting from subtracting an input number of years denoted by input_int_datatype to the input date denoted by input_date_datatype.

Usage:

  • set output_date_identifier = call date_subtract_year ( input_date_identifier, input_int_identifier );

Jump to top

DATE_SUBTRACT_DATE function

Returns a date denoted by output_date_identifier resulting from subtracting the first input date denoted by input_date_datatype1 from a second input date denoted by input_date_datatype2.

Usage:

  • set output_date_identifier = call date_subtract_date ( input_date_identifier1, input_date_identifier2 );

Jump to top

DATETIME (datatype) processing functions and procedures

  • datetime_get_day
  • datetime_get_day_name
  • datetime_get_hour
  • datetime_get_minute
  • datetime_get_month
  • datetime_get_second
  • datetime_get_timezone
  • datetime_get_year
  • datetime_set_day
  • datetime_set_hour
  • datetime_set_minute
  • datetime_set_month
  • datetime_set_second
  • datetime_set_timezone
  • datetime_set_year

List processing functions and procedures

LIST_ADD_ELEMENT_LEFT procedure

Add a new element to the left side of a list.

Usage:

  • call list_add_element_left (list_identifier, identifier);

Example: list_add_element_left

declare int i1;
declare real r1, r2;
declare list L1;

set i1 = 1;
set r1 = 3.14;
set r2 = 2.718;
call list_add_element_left (L1, i1);
call list_add_element_left (L1, r1);
call list_add_element_left (L1, r2);
call print (L1, "\n");

Output from list_add_element_left

{2.718, 3.14, 1}

Jump to top

LIST_ADD_ELEMENT_RIGHT procedure

Add a new element to the right side of a list.

Usage:

  • call list_add_element_right ( list_identifier, identifier );

Example: list_add_element_right

declare int i1;
declare real r1, r2;
declare list L1;

set i1 = 1;
set r1 = 3.14;
set r2 = 2.718;
call list_add_element_right (L1, i1);
call list_add_element_right (L1, r1);
call list_add_element_right (L1, r2);
call print (L1, "\n");

Output from list_add_element_right

{1, 3.14, 2.718}

Jump to top

LIST_COPY_ELEMENT_LEFT function

Copy the leftmost element in a list.

Usage:

  • set list_identifier = call list_copy_element_left (input_list_identifier, whole number);

Example: list_get_element_left

declare int i1;
declare real r1, r2;
declare list L1, L2;

set i1 = 1;
set r1 = 3.14;
set r2 = 2.718;
call list_add_element_right (L1, i1);
call list_add_element_right (L1, r1);
call list_add_element_right (L1, r2);
set L2 = call list_copy_element_left (L1);
call print (L2, "\n");

Output list_copy_element_left

{1}

Jump to top

LIST_COPY_ELEMENT_RIGHT function

Copy the rightmost element in a list.

Usage:

  • set list_identifier = call list_copy_element_right (input_list_identifier, whole number);

Example: list_copy_element_right

declare int i1;
declare real r1, r2;
declare list L1, L2;

set i1 = 1;
set r1 = 3.14;
set r2 = 2.718;
call list_add_element_right (L1, i1);
call list_add_element_right (L1, r1);
call list_add_element_right (L1, r2);
set L2 = call list_copy_element_right (L1);
call print (L2, "\n");

Output list_copy_element_right

{2.718}

Jump to top

LIST_DELETE_ELEMENT_LEFT procedure

Remove the leftmost element from a list.

Usage:

  • call list_delete_element_left (input_list_identifier);

Example: list_delete_element_left

declare int i1;
declare real r1, r2;
declare list L1;

set i1 = 1;
set r1 = 3.14;
set r2 = 2.718;
call list_add_element_right (L1, i1);
call list_add_element_right (L1, r1);
call list_add_element_right (L1, r2);
call list_delete_element_left (L1);
call print (L1, "\n");

Output from list_delete_element_left

{3.14, 2.718}

Jump to top

LIST_DELETE_ELEMENT_RIGHT procedure

Remove the rightmost element from a list.

Usage:

  • call list_delete_element_right (input_list_identifier);

Example: list_delete_element_right

declare int i1;
declare real r1, r2;
declare list L1;

set i1 = 1;
set r1 = 3.14;
set r2 = 2.718;
call list_add_element_right (L1, i1);
call list_add_element_right (L1, r1);
call list_add_element_right (L1, r2);
call list_delete_element_right (L1);
call print (L1, "\n");

Output from list_delete_element_left

{1, 3.14}

Jump to top

LIST_LENGTH function

Retrieve the number of elements in a list.

Usage:

  • set int_identifier = call list_length (input_list_identifier);

Example: list_length

declare int i1, num_items;
declare real r1, r2;
declare list L1;

set i1 = 1;
set r1 = 3.14;
set r2 = 2.718;
call list_add_element_right (L1, i1);
call list_add_element_right (L1, r1);
call list_add_element_right (L1, r2);
set num_items = call list_length (L1);
call print (num_items, "\n");

Output from list_length

3

Jump to top

String processing functions and procedures

STRING_COMPARE function

Compare string1 to string2. Possible return values:

  • -1 = string1 is less-than the string2,
  • 0 = string1 is equal to string2,
  • 1 = string1 is greater-than string2.

Usage:

  • set identifier = call string_compare (string1, string2);

Example: string_compare

declare string s1, s2;
declare int result1, result2, result3;

set s1 = "Never odd or even";
set s2 = "Never even or odd";
set result1 = call string_compare (s1, s2);
set result2 = call string_compare (s2, s1);
set result3 = call string_compare (s1, s1);
call print (result1, "\n");
call print (result2, "\n");
call print (result3, "\n");

Output from string_compare

1
-1
0

Jump to top

STRING_COPY_REVERSE function

Copy the string stored in input_string_identifier in reverse order.

Usage:

  • set output_string_identifier = call string_copy_reverse (input_string_identifier);

Example: string_copy_reverse

declare string input_string, reversed_string;

set input_string = "Never odd or even"
set reversed_string = call string_copy_reverse (input_string);
call print (reversed_string, "\n");

Output from string_copy_reverse

neve ro ddo reveN

Jump to top

STRING_COPY_SEGMENT function

Copy the string segment beginning at begin_byte_identifier and ending at end_byte_identifier inclusive from string source input_string_identifier. Note: constants may be used instead of identifiers for the beginning and ending byte positions.

Usage:

  • set output_string_identifier = call string_copy_segment (input_string_identifier, begin_position_identifier, end_position_identifier);
  • set output_string_identifier = call string_copy_segment (input_string_identifier, begin_position_constant, end_position_identifier);
  • set output_string_identifier = call string_copy_segment (input_string_identifier, begin_position_identifier, end_position_constant);
  • set output_string_identifier = call string_copy_segment (input_string_identifier, begin_position_constant, end_position_constant);

Example: string_copy_segment

declare string input_string, output_string1, output_string2, output_string3, output_string4;
declare int begin_byte_position, end_byte_position;

set begin_byte_position = 0;
set end_byte_position = 2;
set input_string = "foo bar baz zab rab oof"
set output_string1 = call string_copy_segment (input_string, begin_byte_position, end_byte_position);
set output_string2 = call string_copy_segment (input_string, 0, end_byte_position);
set output_string3 = call string_copy_segment (input_string, begin_byte_position, 2);
set output_string4 = call string_copy_segment (input_string, 0, 2);
call print (output_string1, "\n");
call print (output_string2, "\n");
call print (output_string3, "\n");
call print (output_string4, "\n");

Output from string_copy_segment

foo
foo
foo
foo

Jump to top

STRING_COPY_SEGMENT_LEFT function

Copy number_of_bytes bytes from string source input_string_identifier beginning at leftmost position of input string.

Usage:

  • set output_string_identifier = call string_copy_segment_left (input_string_identifier, number_of_bytes);

Example: string_copy_segment_left

declare string input_string, output_string1, output_string2;
declare int number_of_bytes;

set number_of_bytes = 7;
set input_string = "foo bar baz zab rab oof"
set output_string1 = call string_copy_segment_left (input_string, number_of_bytes);
set output_string2 = call string_copy_segment_left (input_string, 7);
call print (output_string1, "\n");
call print (output_string2, "\n");

Output from string_copy_segment_left

foo bar
foo bar

Jump to top

STRING_COPY_SEGMENT_RIGHT function

Copy number_of_bytes bytes from the end of input string source input_string_identifier.

Usage:

  • set output_string_identifier = call string_copy_segment_right (input_string_identifier, number_of_bytes);

Example: string_copy_segment_right

declare string input_string, output_string1, output_string2;
declare int number_of_bytes;

set number_of_bytes = 7;
set input_string = "foo bar baz zab rab oof"
set output_string1 = call string_copy_segment_right (input_string, number_of_bytes);
set output_string2 = call string_copy_segment_right (input_string, 7);
call print (output_string1, "\n");
call print (output_string2, "\n");

Output from string_copy_segment_right

rab oof
rab oof

Jump to top

STRING_COPY_LOWERCASE function

Copy string stored in input_string_identifier converting all uppercase characters to lowercase.

Usage:

  • set output_string_identifier = call string_copy_lowercase (input_string_identifier);

Example: string_copy_lowercase

declare string input_string, output_string;

set input_string = "FOO! 'BAR?' \"BAZ\"."
set output_string = call string_copy_lowercase (input_string);
call print (output_string, "\n");

Output from string_copy_lowercase

foo! 'bar?' "baz".

Jump to top

STRING_COPY_UPPERCASE function

Copy string stored in input_string_identifier converting all lowercase characters to uppercase.

Usage:

  • set output_string_identifier = call string_copy_uppercase (input_string_identifier);

Example: string_copy_uppercase

declare string input_string, output_string;

set input_string = "foo! 'bar?' \"baz\".";
set output_string = call string_copy_uppercase (input_string);
call print (output_string, "\n");

Output from string_copy_uppercase

FOO! 'BAR?' "BAZ".

Jump to top

STRING_COPY_TITLECASE function

Copy string stored in input_string_identifier converting each letter in a word to lowercase except for the first letter. The first letter is converted to uppercase.

Usage:

  • set output_string_identifier = call string_copy_titlecase (input_string_identifier);

Example: string_copy_titlecase

declare string input_string, output_string;

set input_string = "FOO! 'BAR?' \"BAZ\".";
set output_string = call string_copy_titlecase (input_string);
call print (output_string, "\n");

Output from string_copy_titlecase

Foo! 'Bar?' "Baz".

Jump to top

STRING_DELETE_SEGMENT procedure

Delete a string segment beginning at begin_byte_position and ending at end_byte_position inclusive from string source input_string_identifier.

Usage:

  • call string_delete_segment (input_string_identifier, begin_position_identifier, end_position_identifier);
  • call string_delete_segment (input_string_identifier, begin_position_identifier, end_position_constant);
  • call string_delete_segment (input_string_identifier, begin_position_constant, end_position_identifier);
  • call string_delete_segment (input_string_identifier, begin_position_constant, end_position_constant);

Example: string_delete_segment

declare string input_string1, input_string2, input_string3, input_string4;
declare int begin_byte_position, end_byte_position;

set begin_byte_position = 4;
set end_byte_position = 7;
set input_string1 = "foo bar baz";
set input_string2 = input_string1;
set input_string3 = input_string1;
set input_string4 = input_string1;
call string_delete_segment (input_string1, begin_byte_position, end_byte_position);
call string_delete_segment (input_string2, begin_byte_position, 7);
call string_delete_segment (input_string3, 4, end_byte_position);
call string_delete_segment (input_string4, 4, 7);
call print (input_string1, "\n");
call print (input_string2, "\n");
call print (input_string3, "\n");
call print (input_string4, "\n");

Output from string_delete_segment

foo baz
foo baz
foo baz
foo baz

Jump to top

STRING_DELETE_SEGMENT_left procedure

Delete number_of_bytes bytes from string source input_string_identifier beginning at leftmost position of input string.

Usage:

  • call string_delete_segment_left (input_string_identifier, number_of_bytes_identifier);
  • call string_delete_segment_left (input_string_identifier, number_of_bytes_constant);

Example: string_delete_segment_left

declare string input_string1, input_string2;
declare int number_of_bytes;

set number_of_bytes = 4;
set input_string1 = "foo bar baz";
set input_string2 = input_string1;
call string_delete_segment_left (input_string1, number_of_bytes);
call string_delete_segment_left (input_string2, 4);
call print (input_string1, "\n");
call print (input_string2, "\n");

Output from string_delete_segment_left

bar baz
bar baz

Jump to top

STRING_DELETE_SEGMENT_right procedure

Delete number_of_bytes bytes from the end of input string source input_string_identifier.

Usage:

  • call string_delete_segment_right (input_string_identifier, number_of_bytes_identifier);
  • call string_delete_segment_right (input_string_identifier, number_of_bytes_constant);

Example: string_delete_segment_right

declare string input_string1, input_string2;
declare int number_of_bytes;

set number_of_bytes = 4;
set input_string1 = "foo bar baz";
set input_string2 = input_string1;
call string_delete_segment_right (input_string1, number_of_bytes);
call string_delete_segment_right (input_string2, 4);
call print (input_string1, "\n");
call print (input_string2, "\n");

Output from string_delete_segment_right

foo bar
foo bar

Jump to top

STRING_SEARCH_ALL_MATCHES function

Return a list of positions (list datatype) for every match of string pattern in an input string. The status UNDEFINED is returned if the string pattern is not found.

Usage:

  • set list_identifier = call string_search_all_matches (input_string_identifier, keyword_identifier);

Example: string_search_all_matches

declare string input_string, keyword;
declare list result;

set input_string = "haystack needle haystack needle";
set keyword = "needle";
set result = call string_search_all_matches (input_string, keyword);
call print (result, "\n");

Output from string_search_all_matches

{9, 25}

Jump to top

STRING_SEARCH_FIRST_MATCH function

Return the first position (whole number) where a string pattern matches an input string. The status UNDEFINED is returned if the string pattern is not found.

Usage:

  • set int_identifier = call string_search_first_match (string_pattern_identifier, input_string_identifier);
  • set int_identifier = call string_search_first_match ("string_pattern", input_string_identifier);

Example: string_search_first_match

declare string input_string, keyword;
declare list result;

set input_string = "haystack needle haystack needle"
set keyword = "haystack";
set result = call string_search_first_match (input_string, keyword);
call print (result, "\n");

Output from string_search_first_match

{0}

Jump to top

STRING_SEARCH_LAST_MATCH function

Return the last position (whole number) where a string pattern matches an input string. The status UNDEFINED is returned if the string pattern is not found.

Usage:

  • set int_identifier = call string_search_last_match (string_pattern_identifier, input_string_identifier);
  • set int_identifier = call string_search_last_match ("string_pattern", input_string_identifier);

Example: string_search_last_match

declare string input_string, keyword;
declare list result;

set input_string = "haystack needle haystack needle";
set keyword = "needle";
set result = call string_search_last_match (input_string, keyword);
call print (result, "\n");

Output from string_search_last_match

{25}

Jump to top

STRING_TRIM procedure

Remove leading bytes which match byte or input_byte_identifier from left side of input_string_identifier and trailing bytes from right of input_string_identifier which match byte or input_byte_identifier. Examples:

Usage:

  • call string_trim (input_string_identifier, "byte");
  • call string_trim (input_string_identifier, input_byte_identifier);

Example: string_trim

declare string input_string1, input_string2;
declare char byte_to_remove;

set byte_to_remove = "-";
set input_string1 = "-------Dashes-------";
set input_string2 = input_string1;
call string_trim (input_string1, "-");
call string_trim (input_string2, byte_to_remove);
call print (input_string1, "\n");
call print (input_string2, "\n");

Output from string_trim

Dashes
Dashes

Jump to top

STRING_TRIM_LEFT procedure

Remove leading bytes from left side of input_string_identifier which match byte.

Usage:

  • call string_trim_left (input_string_identifier, "byte");
  • call string_trim_left (input_string_identifier, input_byte_identifier);

Example: string_trim_left

declare string input_string1, input_string2;
declare char byte_to_remove;

set byte_to_remove = " ";
set input_string1 = "     Leading spaces.";
set input_string2 = input_string1;
call string_trim_left (input_string1, " ");
call string_trim_left (input_string2, byte_to_remove);
call print (input_string1, "\n");
call print (input_string2, "\n");

Output from string_trim_left

Leading spaces.
Leading spaces.

Jump to top

STRING_TRIM_RIGHT procedure

Remove trailing bytes from right side of input_string_identifier which match byte.

Usage:

  • call string_trim_right (input_string_identifier, "byte");
  • call string_trim_right (input_string_identifier, input_byte_identifier);

Example: string_trim_right

declare string input_string1, input_string2;
declare char byte_to_remove;

set byte_to_remove = ".";
set input_string1 = "Trailing periods....";
set input_string2 = input_string1;
call string_trim_right (input_string1, ".");
call string_trim_right (input_string2, byte_to_remove);
call print (input_string1, "\n");
call print (input_string2, "\n");

Output from string_trim_right

Trailing periods
Trailing periods

Jump to top

TIME (datatype) processing functions and procedures

  • time_set_hour
  • time_set_minute
  • time_set_second
  • time_set_timezone

Math functions

FACTORIAL function

Compute the factorial for a non-negative integer.

Usage:

  • set output_integer_identifier = call factorial (input_integer_identifier);
  • set output_integer_identifier = call factorial (input_integer_constant);

Example: factorial

declare int input_number, result1, result2;

set input_number = 25;
set result1 = call factorial (input_number);
set result2 = call factorial (25);
call print (output_string1, "\n");
call print (output_string2, "\n");

Output from factorial

15511210043330985984000000
15511210043330985984000000

Jump to top

NTH_ROOT_BISECTION_METHOD function

Compute the nth_root of a number using bisection method. The input number may be int, real, imaginary, or complex datatype. Note: this function will return two roots as a list datatype. Results may be may be integer, real, imaginary, or complex.

Usage:

  • set output_list_identifier = call nth_root_bisection_method (input_number_identifier);

Jump to top

NTH_ROOT_NEWTON_RAPHSON_METHOD function

Compute the nth_root of a number using the Newton-Raphson method. The input number may be int, real, imaginary, or complex datatype. Note: this function will return two roots as a list datatype. Results may be may be integer, real, imaginary, or complex.

Usage:

  • set output_list_identifier = call nth_root_newton_method (input_number_identifier);

Jump to top

Datatype conversion functions

BOOL_TO_INT function

Convert bool datatype to int dataype.

Usage:

  • set output_integer_identifier = call bool_to_int (input_boolean_identifier);

Jump to top

BOOL_TO_REAL function

Convert bool datatype to real dataype.

Usage:

  • set output_real_identifier = call bool_to_real (input_boolean_identifier);

Jump to top

BOOL_TO_STRING function

Convert bool datatype to string dataype.

Usage:

  • set output_string_identifier = call bool_to_string (input_boolean_identifier);

Jump to top

COMPLEX_TO_LIST function

Convert complex datatype into a list dataype with two elements. The first element is the real component of the complex number. The second element is the imaginary component of the complex number.

Usage:

  • set output_list_identifier = call complex_to_list (input_complex_identifier);

Jump to top

COMPLEX_TO_STRING function

Convert complex datatype to string dataype.

Usage:

  • set output_string_identifier = call complex_to_string (input_complex_identifier);

Jump to top

DATE_TO_LIST function

Convert date datatype to list dataype.

Usage:

  • set output_list_identifier = call date_to_list (input_date_identifier);

Jump to top

DATE_TO_STRING function

Convert date datatype to string dataype.

Usage:

  • set output_string_identifier = call date_to_string (input_date_identifier);

Jump to top

INT_TO_BOOL function

Convert int datatype to bool dataype.

Usage:

  • set output_boolean_identifier = call int_to_bool (input_integer_identifier);

Jump to top

INT_TO_REAL function

Convert int datatype to real dataype.

Usage:

  • set output_real_identifier = call int_to_real (input_integer_identifier);

Jump to top

INT_TO_STRING function

Convert int datatype to string dataype.

Usage:

  • set output_string_identifier = call int_to_string (input_integer_identifier);

Jump to top

LIST_TO_STRING function

Convert LIST datatype to string dataype.

Usage:

  • set output_string_identifier = call list_to_string (input_list_identifier);

Jump to top

REAL_TO_BOOL function

Convert real datatype to bool dataype.

Usage:

  • set output_boolean_identifier = call real_to_bool (input_real_identifier);

Jump to top

REAL_TO_INT function

Convert real datatype to int dataype. Note: input real right of decimal will be truncated upon conversion to int datatype. Example:

Usage:

  • set output_integer_identifier = call real_to_int (input_real_identifier);

Jump to top

REAL_TO_STRING function

Convert real datatype to string dataype.

Usage:

  • set output_string_identifier = call real_to_string (input_real_identifier);

Jump to top

STRING_TO_BOOL function

Convert string datatype to bool dataype.

Usage:

  • set output_boolean_identifier = call string_to_bool (input_string_identifier);

Jump to top

STRING_TO_DATE function

Convert string datatype to date dataype.

Usage:

  • set output_date_identifier = call string_to_date (input_string_identifier);

Jump to top

STRING_TO_INT function

Convert string datatype to int dataype.

Usage:

  • set output_integer_identifier = call string_to_int (input_string_identifier);

Jump to top

STRING_TO_LIST function

Convert string datatype to list dataype.

Usage:

  • set output_list_identifier = call string_to_list (input_string_identifier);

Jump to top

STRING_TO_REAL function

Convert string datatype to real datype.

Usage:

  • set output_real_identifier = call string_to_real (input_string_identifier);

Jump to top


Copyright © 2025, 2026 Robert James Bruce.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at https://www.gnu.org/licenses/fdl-1.3.html