Functions Returning Integers

  Previous topic Next topic  

These functions return integers.

int beginsWithCase(string exp string,
 string exp str1[, string exp str2...])
int beginsWithNoCase(string exp string,
 string exp str1[, string exp str2...])

These functions compare a string to a list of strings to see if string begins with any of the strings in the list. If string does not begin with any strings, then these functions will return 0, else the functions return 1 or greater. For instance, if string begins with str1, then the functions will return 1, if string begins with str2, then the functions will return 2, etc.

beginsWithCase() performs a case sensitive compare, while beginsWithNoCase() performs a case insensitive compare.

These functions are implemented only in CSE HTML Validator v8.9920 and later.

int checkString(int exp flags, string exp string)

flags - can be added together

1 - returns TRUE if string has leading space characters

2 - returns TRUE if string has ending space characters

4 - returns TRUE if string appears to be an absolute URL missing a protocol; v4.50 replaces character references and URL decodes before checking; v8.00 has improved detection and sets $checkstring4domain if returns TRUE

8 - returns TRUE if string begins with a letter (A-Z or a-z) and consists of the following characters: (A-Z), (a-z), (0-9), hyphens (-), underscores (_), colons (:), and periods (.); this is based on the HTML 4.01 specification for the valid characters of ID and NAME tokens; also see 2097152; also see checkStringEx(0,35)

16 - returns TRUE if string begins with a letter (A-Z or a-z)

32 - returns TRUE if string contains any collapsed PHP, ASP, etc. code. (looks for strings like "!PHP!", "!ASP!", and "!MIVA!" in string and returns TRUE if it finds it) (New v4.0330)

64 - returns TRUE if string ends in a '#' character (not considering trailing spaces) and string does not contain more than one '#' character (New v4.0410)

128 - returns TRUE if string contains a '#' character that is surrounded by one or more spaces and string does not contain more than one '#' character (New v4.0410)

256 - returns TRUE if string appears to be an internal link (starts with the character '#' and does not contain more than one '#' character) (New v4.0410)

512 - returns TRUE if string appears to be a valid email address (ignores the '?' character and everything after it); as of v6.01, if returning FALSE, then sets 1) $checkstring512details with details about the incorrect syntax, 2) $checkstring512detailsnumchecked with the number of email addresses checked (new v6.50), and 3) $checkstring512detailsqmarkindex with the index of the first occurance of the character '?' based on the last checked email address (new v6.50); as of v6.01, works with multiple email addresses separated by commas NOTE: Always returns TRUE if email address syntax checking has been disabled. (New v4.05)

1024 - use with flag 512; ignores any "mailto:" prefix in string when checking for a valid email address (New v4.05)

2048 - returns TRUE if the string contains any space characters (New v4.5000)

4096 - returns TRUE if a '%' character is found that is not followed by two hexadecimal digits (New v4.5000)

8192 - returns TRUE if string consists only of lowercase characters, numbers, backslashes, and underscore characters, and has a maximum of one colon and one period (New v4.5021)

16384 - returns TRUE if string consists only of lowercase characters, numbers, and underscore characters, and has a maximum of one period (New v4.5022)

32768 - returns the number of possible misspellings in string and adds the possibly misspelled words to the list of possibly misspelled words (New v4.5091)

65536 - use with flag 512; URL decode (percent-decode) email address before checking (New v7.9914)

131072 - returns TRUE if string is at least one character and does not start with a U+005F LOW LINE (_) underscore character; v10.9923+ ignores preceding space characters  (New v9.9914)

262144 - returns TRUE if string is a recognized scripting language content type (New v9.9924)

524288 - returns TRUE if string contains non-whitespace characters (New v9.9930)

1048576 - returns TRUE if string begins with optional whitespace, then 0's then a semicolon (New v9.9931)

2097152 - use with flag 8 to allow space-separated tokens (New v10.9923)

string - the string to check

The default return value is 0 (FALSE) unless it is changed due to a flag.

This function is implemented only in CSE HTML Validator v4.0320 and later.

int checkStringEx(int exp flags, int exp mode,
 string exp string)

flags - can be added together; the flags value depends on mode so see the values for mode below for available flags; if a mode does not say anything about flags, then the flags value is not used and should be 0.

mode - can not be added together

1 - return TRUE if string is a valid charset like "iso-8859-1"; also see mode 32

2 - return TRUE if string ends with a comma (disregarding trailing whitespace) (New v5.0200)

3 - return TRUE if string appears to be a valid "lang" attribute value; flags below (New v5.4910)

1 - set $checkstringex3append to a suggested message to append to any error message

4 - return TRUE if string begins with a '#' character (disregards preceding whitespace) (New v5.4910)

5 - return TRUE if string contains two or more adjacent hyphens (use for checking comments; excludes beginning "!--" and ending "--", returns FALSE if string begins with "!--#"); if returns TRUE then use getLocation(7,0) to get location of hyphens (New v5.4910)

6 - return TRUE if string ends in "--" followed by one or more spaces (New v5.4910)

7 - return the number of words in string (New v5.4930)

8 - return the number of repeated words/phrases given a comma separated list in string; a list of repeated words/phrases is stored in $repeatedlist; the number of "empty" words is stored in #numemptywords (New v5.4940)

9 - returns TRUE if string is a percent (New v5.4940)

10 - returns TRUE if string contains only digits 0-9 (must contain at least one digit); flags below (New v5.5100)

1 - allow leading whitespace

2 - allow trailing whitespace

4 - allow an optional preceeding '-' character

8 - require preceeding '-' character

16 - allow zero or one '.' characters

32 - require one '.' character

64 - allow an optional ending '%' character

128 - require ending '%' character

256 - instead of returning TRUE or FALSE, return one of following values

>=0 - value is OK

<0 - value is NOT OK

1 - value is a percent >100% (only if flag 512 set)

-1 - miscellaneous reason why value is not OK

-2 - misplaced or multiple '-' characters

-3 - multiple '.' characters

-4 - missing required '-' character

-5 - missing required '.' character

-6 - missing required '%' character

-7 - contains unallowed character or bad format

-8 - contains no digits (must contain at least 1)

512 - use with flag 256 to allow a return value of 1

11 - returns TRUE if string contains only whitespace characters (one or more); also see 33 (New v5.9910)

12 - returns TRUE if string is an index page (such as "index.htm", "index.html", "index.php", "index.asp") or if the string ends in a "/" followed by an index page (New v5.9910)

1 - if returning TRUE, then create variables $checkstringex12docname (contains "index.htm", "index.php", etc) and $checkstringex12recommendedurl (contains the recommended replacement URL)

13 - returns TRUE if string contains a semicolon and period but no comma between two '@' characters (used for checking mailto links with multiple email addresses that could incorrectly be separated with semicolons instead of commas) (New v6.4930)

14 - returns TRUE if string contains optional whitespace followed by optional digits (0-9) followed by optional whitespace followed by a CSS length unit; if returns TRUE, then the length unit is stored in $checkstringex14unit (New v6.4930)

15 - returns TRUE if string appears to contain mismatched double or single quotation marks (New v6.4940)

1 - only check if value is <=100 characters

16 - returns TRUE if string appears to contain improper backslashes instead of forward slashes (use for checking links) (New v6.9921)

17 - returns TRUE if string appears to contain an improper double slash sequence (use for checking links) (New v6.9931)

18 - returns the number of commas in string (New v7.0000)

19 - returns TRUE if string is recognized as a web-safe typeface; if there are no recognized web-safe typefaces (if the list of recognized web-safe typefaces has been cleared), then will always return TRUE (New v8.00)

20 - checks a comma separated list of typefaces in string and returns FALSE if any of them are not recognized as "web-safe", which means that they may not be available on a significant number of browsers; else returns TRUE; if returns FALSE, then a list of the unrecognized typefaces is available in $checkstringex20list (with $checkstringex20listnum containing the number of typefaces in the list) and a complete list (including ignored typefaces) is available in $checkstringex20list2 (with $checkstringex20list2num containing the number of typefaces in the list).
 
In v8.9950 and above, if not all the typefaces are web-safe, then $checkstringex20unknownlist is also set with a list of unrecognized typeface names. $checkstringex20unknownlistnum contains the number of typefaces listed in $checkstringex20unknownlist.
 
In v10.0146 and above, if not all the typefaces are web-safe, then $checkstringex20numwebsafe is also set with the number of recognized web-safe typeface names, not including the generic font family keywords (like serif, sans-serif, monospace, etc.).
 
In v10.9912 and above, $checkstringex20extrainfo is also set with extra information about the listed typefaces, if it is available (if not available then it is empty).
 
NOTE: Once a typeface is recognized as not being web-safe and the number of recognized web-safe typefaces is 0, the typeface is ignored in further calls to this function for the duration of the validation. This is to prevent the same typeface (when used multiple times) from generating more than one validator message. You can add to the recognized list of web-safe typefaces using setValueString(10,typeface name) in the onConfigLoad() function. flags below

1 - do not consider ignored typefaces from previous calls when returning TRUE or FALSE

2 - do not use; this flag used internally

21 - checks a comma separated list of typefaces in string and returns FALSE if there are any unrecognized typefaces or if typefaces from more than one family were specified. If returns FALSE, then sets $checkstringex21msg with the text of a message to display, $checkstringex21numunrec with the number of unrecognized typefaces, $checkstringex21msgtype with the recommended message type (regular message if there were no unrecognized typefaces or a warning message type if there were unrecognized typefaces), and (in v9.0192 and later) $checkstringex21msgid with a recommended message ID. NOTE: Once a typeface is not recognized, it is ignored in further calls to this function for the duration of the validation. This is to prevent the same typeface being used multiple times from generating more than one validator message about it. You can add to the recognized list of typefaces using setValueString(11,typeface name) in the onConfigLoad() function. flags below

2 - do not use; this flag used internally

22 - returns TRUE if string contains a Sitestepper variable and Sitestepper integration is both on and supported in the edition being used (supported in std/pro editions) (New 8.0200)

23 - returns TRUE if string appears to be a link that can be passed to the link checker (preceding space characters are ignored) (New 8.9910)

24 - returns TRUE if string is a recognized typeface name (New 8.9950)

25 - checks a comma separated list of typefaces in string and returns FALSE if there is a possible issue with CLF 2.0 compliance. If returns FALSE, then sets $checkstringex25msg with the text of a message to display, $checkstringex25numunrec with the number of possibly incompliant typefaces, $checkstringex25msgtype with the recommended message type, and $checkstringex25msgid with a recommended message ID. NOTE: Once a typeface is not recognized, it is ignored in further calls to this function for the duration of the validation. This is to prevent the same typeface being used multiple times from generating more than one validator message about it. You can add to the recognized list of typefaces using setValueString(11,typeface name) in the onConfigLoad() function. flags below

2 - do not use; this flag used internally

26 - returns an int representing the color in string; works with colornames and colors in the format #RRGGBB; ignores preceding space characters; returns -1 if fails (New 9.9910)

27 - returns an int based on the value of string; for use with "input" elements to represent the value of the "type" attribute as an integer (set string to the value of the "type" attribute); case insensitive; runs program 65 (with flag 1) if it's an HTML5 control value and the program is running in an attribute or attribute value program (New v9.9914)

set flag 1 to NOT run program 65 (New v9.9927)

return values: 0-(unknown), 1-image, 2-file, 3-textarea, 4-text (default), 5-checkbox, 6-radio, 7-password, 8-hidden, 9-submit, 10-reset, 11-button, HTML5: 12-search, 13-tel, 14-url, 15-email, 16-datetime, 17-date, 18-month, 19-week, 20-time, 21-datetime-local, 22-number, 23-range, 24-color

28 - returns TRUE if the CSS property string was used in the value of the "style" attribute else returns FALSE; always returns FALSE if style checking is not enabled; forces style checking of the "style" attribute if style checking is enabled (New v9.9927)

29 - returns TRUE if string contains only recognized values for the "rel" attribute of the "link" element (separated by whitespace; case insensitive); else returns FALSE and sets $checkstringex29badlist with a quoted list of the unrecognized values, $checkstringex29badlistnum with the number of unrecognized values, and (in v10.9944+) $checkstringex29badmsgappend with a suggested string to append to any error message (New v9.9933)

30 - returns TRUE if string contains at least one U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) character (New v10.9921)

31 - returns TRUE if string contains any space characters, not considering any preceding and trailing space characters (New v10.9923)

32 - like 1, but also returns true if string contains any collapsed PHP, ASP, etc. code (New v10.9923)

33 - returns TRUE if string is empty or contains only whitespace characters; also see 11 (New v10.9923)

34 - returns an int based on the value of string; for use with WAI-ARIA "role" attributes to represent the value of the attribute as an integer (set string to the value of the "role" attribute); case insensitive (New v10.9926)

return values: 0-(unknown), 1-alert, 2-alertdialog, 3-application, 4-article, 5-banner, 6-button, 7-checkbox, 8-columnheader, 9-combobox, 10-complementary, 11-contentinfo, 12-definition, 13-dialog, 14-directory, 15-document, 16-form, 17-grid, 18-gridcell, 19-group, 20-heading, 21-img, 22-link, 23-list, 24-listbox, 25-listitem, 26-log, 27-main, 28-marquee, 29-math, 30-menu, 31-menubar, 32-menuitem, 33-menuitemcheckbox, 34-menuitemradio, 35-navigation, 36-note, 37-option, 38-presentation, 39-progressbar, 40-radio, 41-radiogroup, 42-region, 43-row, 44-rowgroup, 45-rowheader, 46-search, 47-separator, 48-scrollbar, 49-slider, 50-spinbutton, 51-status, 52-tab, 53-tablist, 54-tabpanel, 55-textbox, 56-timer, 57-toolbar, 58-tooltip, 59-tree, 60-treegrid, 61-treeitem

35 - returns TRUE if string is a valid HTML5 ID token (at least one character and no space characters); also see checkString(8) (New v11.0043)

36 - returns TRUE if string begins with a letter (A-Z or a-z) and consists of the following characters: (A-Z), (a-z), (0-9), hyphens (-), and underscores (_); this is based on the HTML 4.01 specification for the valid characters of ID and NAME tokens but excludes the possibly problematic period (.) and colon (:) characters (New v11.0043)

37 - returns TRUE if string is a valid value for a "link" element's "sizes" attribute, else returns FALSE and sets $checkstringex37badlist (New v11.0114)

string - the string to check

The default return value is 0 (FALSE) unless it is changed due to a valid mode.

This function is implemented only in CSE HTML Validator v4.9910 and later.

int checkVersion(float exp version)

version - the minimum version of the validator required for the function to return 1

Returns 1 if using HTML Validator version version or greater, else the function returns 0.

Use this to help make sure that the procedures and functions that are being used are valid for the version of CSE HTML Validator that is executing them.

int endsWithCase(string exp string,
 string exp str1[, string exp str2...])
int endsWithNoCase(string exp string,
 string exp str1[, string exp str2...])

These functions compare a string to a list of strings to see if string ends with any of the strings in the list. If string does not end with any strings, then these functions will return 0, else the functions return 1 or greater. For instance, if string ends with str1, then the functions will return 1, if string ends with str2, then the functions will return 2, etc.

endsWithCase() performs a case sensitive compare, while endsWithNoCase() performs a case insensitive compare.

These functions are implemented only in CSE HTML Validator v11.0111 and later.

int getAttIndex(string exp attribute)
int getAttIndexForStartTag(string exp attribute)

attribute - the attribute in the tag to search for

Returns the index of the attribute. If the attribute does not exist, then the function returns 0. For example, if the attribute exists and is the first attribute for the tag, then the function returns 1.

getAttIndexForStartTag() is like getAttIndex() but can also be used in an end tag program to get the attribute index of the corresponding start tag; may require that runProgram(21) be used in the start tag name program (New v11.0112)

int getNumAttributes()

Returns the number of attributes for the current tag.

The integer keyword numAttributes is now recommended instead (New v10.0140)

int getStringStartIndex(string exp string1, string exp string2)

Searches for string2 in string1 and returns the index into string1 where string2 starts.

The index is 0 based. For example, if string2 is contained in the very beginning of string1, then the function returns 0.

If string2 is not in string1, then the function returns -1.

Performs a case insensitive search.

This function is implemented only in CSE HTML Validator v3.03 and later.

int getValueInt(int exp valueidentifier)

valueidentifier - tells the function which value to return

1 - the current number of error messages generated

2 - the current number of warning messages generated

3 - the current number of message messages generated

4 - the current number of comment messages generated

5 - returns 1 if compiled for a "normal" build (not an OEM version), else returns another value

6 - returns 1 if running from command line arguments, else returns 0

7 - returns 1 if processing a batch (for example, called with cmdlineprocessor.exe -f), else returns 0

8 - returns the number of lines in the document (New v4.00)

9 - returns the number of elements (tags) in the document (New v4.00)

10 - returns the number of elements (tags) that have been ended (with an end tag) (New v4.00)

11 - returns the number of HTML comments in the document (New v4.00)

12 - returns the number of entities in the document (New v4.00)

13 - returns the number of tag name programs run (New v4.00)

14 - returns 1 if the validator is generating an easily parsed output file (usually used when integrating with other applications), else returns 0 (New v4.00)

15 - returns 1 if the validator is validating a file in CSE's integrated editor (not in classic mode), else returns 0 (New v4.00)

16 - returns 1 if the validator is validating a file in CSE's integrated editor (whether in classic mode or not), else returns 0 (New v4.00)

17 - returns the number of bytes in the document (each newline is considered 1.5 bytes) (New v4.0012)

18 - returns 1 if the validator is validating a file in the Batch Wizard, else returns 0 (New v4.02)

19 - returns 1 if there have been too many errors or warnings and the validation is being terminated (New v4.5021)

20 - [the integer keyword CSEJOBSUBTYPE is now recommended instead] returns CSEJOBSUBTYPE (New v4.5091)

21 - [the integer keyword CurrentAttIndex is now recommended instead] returns the attribute index for attribute programs or attribute value programs (should be >=1) (New v4.5091)

22 - [the integer keyword DocTypeFlags is now recommended instead] returns doctypeflags (contains information about the DOCTYPE being used) (New v4.5110)

1 - DOCTYPE is empty string

2 - DOCTYPE contains "strict" (case insensitive)

4 - DOCTYPE contains "transitional" (case insensitive)

8 - DOCTYPE contains "frameset" (case insensitive)

16 - DOCTYPE contains "HTML 4.0" or "HTML 4.01" (case insensitive)

32 - DOCTYPE contains "XHTML" (case insensitive)

64 - DOCTYPE contains "XHTML 1.1" (case insensitive) (New v5.0200)

128 - DOCTYPE contains "XHTML 1.0" (case insensitive) (New v5.0200)

256 - DOCTYPE contains "HTML" (case insensitive) (New v5.4910)

512 - DOCTYPE contains "XHTML Basic" (case insensitive) (New v5.4920)

1024 - Document has no DOCTYPE (or the DOCTYPE hasn't been set/encountered yet) (New v5.4930)

2048 - DOCTYPE contains "HTML 3.2" (case insensitive) (New v5.9910)

4096 - DOCTYPE contains "HTML 3.0" (case insensitive) (New v5.9910)

8192 - DOCTYPE contains "HTML 2.0" (case insensitive) (New v5.9910)

16384 - DOCTYPE contains " HTML 4.0" followed by a non-digit (case insensitive) (New v6.4930)

32768 - DOCTYPE contains " HTML 4.01" (case insensitive) (New v6.4930)

65536 - DOCTYPE contains "HTML" but not "XHTML" (case insensitive) (New v6.4930)

131072 - DOCTYPE contains " mobile" (case insensitive) (New v9.0200)

262144 - DOCTYPE appears to be HTML 5 (like <!DOCTYPE HTML>) (New v9.9913)

524288 - DOCTYPE contains "about:legacy-compat" (case insensitive) (New v9.9913)

Only one or none of the following flags will be set: 16, 2048, 4096, 8192, 262144

23 - returns the number of characters of the text content of the tag that is being closed; preceding and trailing spaces are not considered; stores the text content (preceding and trailing spaces, if any, are removed) in a variable named getvalueint23content; for v11.0000 and below: use in a tag close program only; see also 41 (New v5.4930)

24 - returns 1 if checking an external style sheet, else returns 0 (New v5.4930)

25 - returns 1 if the current tag is closed with "/>", else returns FALSE; use in a tag name start program, attribute program, or attribute value program only (New v5.5100)

26 - [the integer keyword isAccEnabled is now recommended instead] returns 1 if accessibility checking is enabled else returns 0 (New v5.9910)

27 - [the integer keyword isWCAG10Enabled is now recommended instead] returns 1 if WCAG 1.0 accessibility checking is enabled else returns 0 (New v5.9910)

28 - [the integer keyword isSection508Enabled is now recommended instead] returns 1 if Section 508 accessibility checking is enabled else returns 0 (New v5.9910)

29 - [the integer keyword isAccAndWCAG10Enabled is now recommended instead] returns 1 if both accessibility checking and WCAG 1.0 accessibility checking are enabled else returns 0 (New v5.9910)

30 - returns 1 if both accessibility checking and Section 508 accessibility checking are enabled else returns 0 (New v5.9910)

31 - returns 1 if the enable sound option is checked else returns 0 (New v5.9920)

32 - returns the number of CDATA sections in the document (New v5.9920)

33 - [the integer keyword isWCAG10P1Enabled is now recommended instead] returns 1 if WCAG 1.0 Priority 1 messages should be displayed, else returns 0 (New v5.9930)

34 - [the integer keyword isWCAG10P2Enabled is now recommended instead] returns 1 if WCAG 1.0 Priority 2 messages should be displayed, else returns 0 (New v5.9930)

35 - [the integer keyword isWCAG10P3Enabled is now recommended instead] returns 1 if WCAG 1.0 Priority 3 messages should be displayed, else returns 0 (New v5.9930)

36 - returns 1 if the job flag for "beginner mode" has been set, else returns 0 (New v6.5200)

37 - returns the number of entries in the ignored CSS properties list (New v7.9910)

38 - [the integer keyword isLegacyEnabled is now recommended instead] returns whether to display legacy validator messages or not; depends on legacyflag and whether the flag specified by legacyflag is set or not (New v7.9910)

39 - returns 1 if in standards compliant mode, else returns 0 (New v7.9923)

40 - [the integer keyword isSearchEngineEnabled is now recommended instead] returns 1 if general search engine messages are enabled, else returns 0 (New 8.9910)

41 - same as 23 except "{text}" is used for ASP and PHP code sections; see also 23 (New v9.0000)

42 - returns the current total number of words spell checked, including words in comments (New v9.0194)

43 - returns the current total number of words spell checked in HTML/XHTML comments (New v9.0194)

44 - returns 1 if the element that is being closed contain non-whitespace text or one of the following elements: "object", "img"; use in a tag name end program only (New v9.9930)

50 - returns valjobflags (New v6.4930)

60 - [the integer keyword isCLF20Enabled is now recommended instead] returns 1 if Common Look and Feel Standards for the Internet (Canada) is enabled, else returns 0 (New v9.9910)

61 - returns 1 if accessibility checking is enabled AND WCAG 1.0 checking is enabled AND WCAG Priority 1 AND Priority 2 messages should be displayed, else returns 0 (New v9.9910)

62 - returns 1 if accessibility checking is enabled AND WCAG 2.0 checking is enabled AND WCAG 2.0 Level A AND Level AA messages should be displayed, else returns 0 (New v10.0125)

70 - [the integer keyword isWCAG20Enabled is now recommended instead] returns 1 if WCAG 2.0 accessibility checking is enabled else returns 0 (New v9.9912)

71 - [the integer keyword isWCAG20AEnabled is now recommended instead] returns 1 if WCAG 2.0 "A" messages should be displayed, else returns 0 (New v9.9912)

72 - [the integer keyword isWCAG20AAEnabled is now recommended instead] returns 1 if WCAG 2.0 "AA" messages should be displayed, else returns 0 (New v9.9912)

73 - [the integer keyword isWCAG20AAAEnabled is now recommended instead] returns 1 if WCAG 2.0 "AAA" messages should be displayed, else returns 0 (New v9.9912)

74 - [the integer keyword isAccAndWCAG20Enabled is now recommended instead] returns 1 if both accessibility checking and WCAG 2.0 accessibility checking are enabled else returns 0 (New v9.9912)

80 - returns the number of foreign CDATA sections in the document (like those in "math" and "svg" sections) (New v11.0043)

81 - returns the number of native CDATA sections in the document (not foreign) (New v11.0043)

100 - returns the current four-digit year (local time) (New v6.0091)

101 - returns the current month (1-12, local time) (New v6.0091)

102 - returns the current day (1-31, local time) (New v6.0091)

103 - returns the current hour (0-23, local time) (New v6.0091)

104 - returns the current minute (0-59, local time) (New v6.0091)

105 - returns the current second (0-59, local time) (New v6.0091)

106 - returns the current millisecond (0-999, local time) (New v6.0091)

107 - returns the current day of the week (0-6, Sunday=0, Monday=1, etc., local time) (New v6.0091)

120 - return number of unique proprietary attributes used so far (like those starting with "x-") (New v11.01)

121 - return number of unique proprietary CSS pseudo-elements used so far (like pseudo-elements starting with "-moz-") (New v11.01)

122 - return number of unique proprietary CSS media features used so far (like media features starting with "-webkit-") (New v11.01)

Returns -1 if an error occurs, such as if valueidentifier is invalid. This function will not generate a validator error message if it returns -1 because valueidentifier is invalid.

This function is implemented only in CSE HTML Validator v3.04 and later.

int hasAtt(string exp att1[, string exp att2...])

Returns the attribute index (1 or greater) of the first attx that exists, else returns 0.

Use in tag name start, attribute, and attribute value programs to quickly determine whether attributes have been used (with or without a value).

This function has changed in v10.9924 and later; it now returns the attribute index of the first attribute found instead of always returning 1 if any attribute is found (this provides more useful information)

This function is implemented only in CSE HTML Validator v10.00 and later.

int hasAttForStartTag(string exp attribute)

Returns 1 if attribute exists in the start tag, else returns zero.

Use only in tag name end programs.

May require that runProgram(21) be used in the start tag name program.

This function is implemented only in CSE HTML Validator v8.00 and later. In versions previous to v11.0114, this functions was hasAttStartTag() (which still works).

int hasAttWithStringValue(string exp attribute,
 string exp value[, int flags])

Returns 1 if attribute exists and has the value value, else returns zero.

Performs a case-insensitive compare and, before comparing, removes any leading and trailing spaces from the attribute value (not from the value parameter and after any character references have been replaced).

flags

1 - value is a token in a space-separated list of tokens (case insensitive) (New v11.0114)

Use only in tag name start programs.

This function is implemented only in CSE HTML Validator v10.00 and later.

int hasChildElement(string exp element1[, string exp element2...])

Returns the element child index (1 or greater) of the first elementx that exists as a child for the element currently being ended, else returns 0.

Use in tag name end programs to quickly determine whether the element being ended contains a child element.

This function is implemented only in CSE HTML Validator v11.0114 and later.

int hasEqual(int exp index)

Returns 1 if the attribute at index has an equals sign following it, else returns zero.

int hasNoValue(string exp name)

name - the name of the variable

Returns 1 if the variable name has not been defined or is an empty string or is 0, else the function returns 1.

This function is implemented only in CSE HTML Validator v10.0127 and later.

int hasValue(string exp name)

name - the name of the variable

Returns 1 if the variable name has been defined and is not an empty string and is not 0, else the function returns 1.

This function is implemented only in CSE HTML Validator v10.0127 and later.

int isAttValueEmpty(int exp index)

Returns 1 if the attribute value at index exists and is empty. The first attribute value has an index of 1, and is the attribute value for the attribute that also has an index of 1. An index of 0 is the value attached to the tag name which generally should not exist.

An empty string may contain no characters at all ("") or it may only contain space characters ("  ").

Generates an error if the attribute at index does not exist, because if the attribute doesn't exist, then it can't have a value.

This function is implemented only in CSE HTML Validator v10.9923 and later.

int isCatActive(int exp categoryid)

categoryid - the id of the category to check

If the category is active, then the function returns 1, else the function returns 0. The active categories are typically set in the Configuration Editor, but can also be set using activateCategories().

int isChildOf(string exp elem1[, string exp elem2...])

Returns 1 if the parent of the current element is elem1, 2 if the parent is elem2, etc.

Returns 0 if the parent of the current element is not one of the arguments.

Performs case-insensitive compares.

Use only in tag name start, tag name end, attribute, and attribute value programs.

This function is implemented only in CSE HTML Validator v11.00 and later.

int isDefined(string exp name)

name - the name of the variable

Returns 0 if the variable name has not been defined, else the function returns nonzero.

int isFlagSet(int exp flag)

flag - the tag name program flag to check

If the tag name program flag is set, then the function returns 1, else the function returns 0. The tag name program flags are set in the Validator Engine Options, but can also be set using setFlag().

 

int isInRange(string exp tagname1[, string exp tagname2...])

Returns a positive integer if the current tag is a descendent (contained in) of any of the listed tag names, else the function returns 0. A tag name (called tag1) is a descendent of another tag (called tag2) if tag2 has been opened but not ended before tag1.

int isNChildTag(int exp n)

Returns n if the current tag is the nth child tag of its parent, or 0 if not.

Use only in tag name start programs, attribute programs, and attribute value programs.

This function is implemented only in CSE HTML Validator v10.00 and later.

int isValueInArray(string exp arrayname,
 string exp value[, int flags])

Checks to see if the value value is in the array of values named arrayname

Returns the first index into the array that equals value or returns -1 if value is not found.

flags

1 - case sensitive search (else case insensitive search)

This function is implemented only in CSE HTML Validator v4.52 and later.

int matchCase(string exp string,
 string exp str1[, string exp str2...])
int matchNoCase(string exp string,
 string exp str1[, string exp str2...])

These functions compare a string to a list of strings to see if string matches any of the strings in the list. If string does not match any strings, then these functions will return 0, else the functions return 1 or greater. For instance, if string matches str1, then the functions will return 1, if string matches str2, then the functions will return 2, etc.

matchCase() performs a case sensitive compare, while matchNoCase() performs a case insensitive compare.

int matchNumber(int exp numtomatch,
 int exp num1[, int exp num2...])

This function compares a number to a list of numbers to see if numtomatch matches any of the numbers in the list. If numtomatch does not match any numbers, then the function will return 0, else the function returns 1 or greater. For instance, if numtomatch matches num1, then the function will return 1, if numtomatch matches num2, then the function will return 2, etc.

This function is implemented only in CSE HTML Validator v10.00 and later.

int matchRegEx(string exp pattern,
 int exp optionflags,
 string exp str1[, string exp str2...])

This function compares a regular expression pattern to a list of strings to see if pattern matches any of the strings in the list. If pattern does not match any strings, then this  function will return 0, else the function returns 1 or greater. For instance, if pattern matches str1, then this function will return 1, if pattern matches str2, then this function will return 2, etc.

optionflags

0 - set optionflags to zero for none of the below options (this will case a case-sensitive match)

1 - case insensitive (default is case-sensitive)

2 - multiline mode; changes the meaning of ^ and $ so they match at the beginning and end, respectively, of any line, and not just the beginning and end of the entire string

4 - single-line mode; changes the meaning of the dot (.) so that it matches every character (instead of every character except \n)

This function uses the "PCRE regex flavor". PCRE is short for Perl Compatible Regular Expressions. This page describes the syntax of regular expressions in Perl.

Example: matchRegEx('^\s*blur\s*\(',0,CurrentAttValue)

This function is implemented only in CSE HTML Validator v11.00 and later.

int random(int exp num)

Returns a random number between 0 and num-1.

This function is implemented only in CSE HTML Validator v7.01 and later.

int strcmp(string exp string1, string exp string2)
int stricmp(string exp string1, string exp string2)
int strncmp(string exp string1, string exp string2,
 int exp length)
int strnicmp(string exp string1, string exp string2,
 int exp length)

These functions compare two strings and return a comparison value. The function returns a value of zero, less than zero, or greater than zero if string1 is equal to, less than, or greater than string2, respectively.

strcmp() and strncmp() perform a case sensitive compare

stricmp() and strnicmp() perform a case insensitive compare

Functions with a length parameter only compare up to the first length characters.

int strlen(string exp string)

Returns the length, in characters, of string.

This function is implemented only in CSE HTML Validator v3.04 and later.