wordcount(
TEXT
)
The wordcount( function returns the number of words in the text.
Parameters
This function has one parameter:
text – text with words to count.
Description
This function counts the number of words in the text.
wordcount("now is the time") ☞ 4
wordcount("or is this the time, or now?") ☞ 7
Note: This function is equivalent to:
extract(arraystrip(replacemultiple(thetext,cr()+":"+tab()+":"+chr(10)," : : ",":")," ")," ",-1)
See Also
- + -- works differently depending on the type of operands used with it.
If both operands are numeric, it does numerical addition.
If either operand is text the + operator concatenates (joins together) the two operands.
- < -- compares two values to see if the first value is less than the second value.
- <= -- compares two values to see if the first value is less than or equal to the second value.
- <> -- compares two values to see if they are different.
- = -- compares two values to see if they are the same.
- > -- compares two values to see if the first value is greater than the second value.
- >= -- compares two values to see if the first value is greater than or equal to the second value.
- after( -- extracts all text after a specified tag (sequence of characters).
- alphabeticnumber( -- converts a number into letters: A, B, C, etc.
- applescriptstring( -- converts text into an AppleScript string literal.
- array( -- extracts a single data item from a text array or a data array (see Text Arrays and Data Arrays).
- arraybuild -- builds an array by scanning a database and creating an array element for every record (including invisible records) in the database (see Text Arrays).
- arraybuild( -- builds an array by scanning a database and creating an array element for every record (including invisible records) in the database (see Text Arrays).
- arraychange( -- changes the value of a single data item in a text array or a data array (see Text Arrays and Data Arrays).
- arraycommonprefix( -- finds the common prefix (if any) of all items in an array.
- arraydeduplicate( -- removes duplicate elements from a text array (see Text Arrays).
- arraydelete( -- deletes (removes) one or more elements from a text array or a data array (see Text Arrays and Data Arrays).
- arrayelement( -- converts between character positions and array element numbers in a text array.
- arrayfilter( -- processes each element of a text array or a data array with a formula (see Text Arrays and Data Arrays).
- arrayhack( -- hacks an array by adding, replacing or removing array elements
- arrayinsert( -- inserts one or more empty elements into the middle of a text array (see [Text Arrays]).
- arraylookup( -- uses a key to look up a value in a two dimensional text array containing key/value pairs (see Text Arrays).
- arraymerge( -- merges two text arrays together (see [Text Arrays]).
- arraynumericsort( -- sorts a text array in numeric order (see Text Arrays).
- arrayrange( -- extracts a series of data items from a text array or a data array (see Text Arrays and Data Arrays).
- arrayrelocate -- moves one or more items in a text array to a new position.
- arrayrelocate( -- moves one or more items to a new position in a text array or a data array (see Text Arrays and Data Arrays).
- arrayreverse( -- reverses the order of the elements in a text array or a data array (see Text Arrays and Data Arrays).
- arrayreverselookup( -- uses a value to look up a key in a two dimensional text array containing key/value pairs (see Text Arrays).
- arraysearch( -- searches a text array or a data array (see Text Arrays and Data Arrays) to see if it contains a specific value.
- arrayselectedbuild -- builds an array by scanning a database and creating an array element for every visible (selected) record in the database (see Text Arrays).
- arrayselectedbuild( -- builds an array by scanning a database and creating an array element for every visible (selected) record in the database (see Text Arrays).
- arraysize( -- returns the number of elements in a text array or a data array (see Text Arrays and Data Arrays).
- arraysort( -- alphabetizes (A-Z) the elements in a text array (see [Text Arrays]).
- arraystrip -- strips blank elements from an array.
- arraystrip( -- removes any blank elements from a text array or a data array (see Text Arrays and Data Arrays).
- asc( -- converts the first character of a text string into a number from 0 to 65535 based on Unicode encoding.
- batchreplace -- performs multiple find and replace operations on a piece of text.
- batchreplace( -- performs multiple find/replace operations on a piece of text.
- before( -- extracts all text before a specified tag (sequence of characters). If the tag doesn't exist the function returns "".
- beginswith -- returns true if the value on the left starts with
the value on the right, false if it doesn't.
- between( -- checks to see if a value is between two other values.
- binarytotext( -- converts binary data into text, optionally using a specified encoding.
- boolstr( -- converts a Boolean value to text, either `"true"` or `"false"`.
- cardtype( -- returns the credit card type (American Express, Visa, MasterCard or Discover).
- characterfilter -- scans and filters text on a character by character basis.
- characterfilter( -- scans and filters text on a character by character basis.
- chevronquoted( -- adds « » quotes to text if necessary to make it a legal Panorama token.
- chr( -- converts a number into a single character of text, based on Unicode encoding.
- chunkarray( -- extracts a binary "chunk" from binary data (see Binary Data).
- clipboard( -- returns whatever text is currently on the computer's clipboard.
- commalist( -- converts a text array (see Text Arrays) into an English list, with items separated by a comma and a space, except for the last two items which are separated by the word *and* and spaces.
- commatocr( -- converts a comma delimited array into a carriage return delimited array.
- commonpath( -- returns the path for common folders (desktop, library, documents, pictures, etc.).
- concatenate( -- concatenates two text strings (same as the + operator).
- connect( -- appends a prefix and suffix together with a connector in between.
- contains -- returns true if the value on the left contains
the value on the right, false if it doesn't.
- containsword -- returns true if the text contains a specified word, false if it doesn't.
- cr( -- generates a carriage return.
- createpassword -- creates a random password using characters or numbers (or a mixture) set to the chosen length.
- crlf( -- generates a carriage return line feed.
- crtolf( -- converts carriage returns into linefeeds.
- crtovtab( -- converts carrige returns (ASCII 0x0D) into vertical tabs (ASCII 0x0B).
- csvtotsv( -- converts comma separated text into tab separated text.
- Date Patterns -- control how dates are displayed or converted to text.
- date( -- converts text into a number representing a date.
- datepattern( -- converts a number representing a date into text. The function uses a pattern to control how the date is formatted (see Date Patterns).
- decodebase64( -- decodes data using Base64.
- decrypt( -- decrypts data.
- defaulttext( -- returns a text value, or returns a default value if the text value is empty ("").
- emojicheats( -- abbreviates any emojis with "emoji cheat" codes.
- encodebase64( -- encodes data using Base64.
- encodeurlfragment( -- encodes text so that it can be used in the fragment portion of a URL (the portion after the # symbol).
- encodeurlhost( -- encodes text so that it can be used in the host portion of a URL (for example www.host.com).
- encodeurlpassword( -- encodes text so that it can be used in the password portion of a URL.
- encodeurlpath( -- encodes text so that it can be used in the path portion of a URL (the portion after the host name, but before any ? symbol).
- encodeurlquery( -- encodes text so that it can be used in the query portion of a URL (the portion after the ? symbol).
- encodeurluser( -- encodes text so that it can be used in the user name portion of a URL.
- encrypt( -- encrypts data.
- endswith -- returns true if the value on the left ends with
the value on the right, false if it doesn't.
- expandemojis( -- expands any "emoji cheat" abbreviations into the actual emojis.
- export -- exports the selected rows in the current database into a text file.
- extract( -- extracts a single data item from a text array, and can also be used to count the number of items in the array.
- filecatalog( -- builds a text array listing the files in a folder, including any subfolders of that folder.
- firstline( -- extracts the first line from the text.
- firstword( -- extracts the first word from the text.
- fixedwidth( -- makes the text a fixed width, padding with spaces if necessary.
- fixedwidthright( -- makes the text a fixed width, padding on the left with spaces if necessary.
- foldersize( -- calculates the size of a folder (in bytes).
- formatphone( -- formats a US phone number using the standard *(aaa) nnn-nnnn* format.
- gettaglocation -- locates the first matching tag within some text.
- groupdatepattern( -- converts a number representing a date into text in a special format for use with the summarytable( and crosstab( functions. The function uses a pattern to control how the date is formatted (see Date Patterns).
- hexbyte( -- converts a limited range of decimal numbers to a two-digit hexadecimal number expressed as a text string.
- hexlong( -- converts a decimal number to an eight-digit hexadecimal number expressed as a text string
- hexstr( -- converts a number to text formatted as a hexadecimal number.
- hexword( -- converts a decimal number to a four-digit hexadecimal number expressed as a text string.
- htmlbold( -- takes the text and adds `` and `` tags to it.
- htmlcolor( -- converts a color name into a hex HTML color (RRGGBB format).
- htmlcolorarray( -- generates a text array of HTML colors that gradually transition from one color to another.
- htmlitalic( -- takes the text and adds `` and `` tags to it.
- htmltablecell( -- extracts the data from a cell in an HTML table.
- htmltablecellexists( -- returns true if an HTML table contains the specified cell, false if it doesn't.
- htmltablecellraw( -- extracts the data from a cell in an HTML table (including tags, if any).
- htmltableheight( -- calculates the height (number of rows) in an HTML table.
- htmltablerow( -- extracts the data from a row in an HTML table.
- htmltablerowraw( -- extracts the raw data (including tags, if any) from a row in an HTML table.
- htmltablewidth( -- calculates the width (number of columns) in an HTML table.
- importcell( -- returns one cell of imported data.
- info("defaultfloatformat") -- returns the default format for converting floating point numbers to text.
- jsonexport( -- converts a Panorama dictionary or data array into JSON.
- jsonexportline( -- exports the current database record in JSON format.
- jsonimport( -- converts JSON into a Panorama dictionary or data array.
- jsonscriptstring( -- converts text into a JSON string literal
- lastline( -- extracts the last line from the text.
- lastword( -- extracts the last word from the text.
- left( -- extracts characters from the left edge of the text.
- length( -- counts the number of characters in a text value (also called a string).
- lf( -- generates a line feed.
- lftocr( -- converts linefeeds into carriage returns.
- like -- checks to see if the text on the left matches the wildcard pattern specified on the right.
- limit( -- checks to see if a value is between a minimum and maximum value. If it is, the value is returned unchanged. If it is below the minimum, the minimum value is returned. If it is above the maximum the maximum value is returned.
- linecount( -- counts the number of carriage return separated lines in the text.
- lineitemarray( -- converts the data in a set of line item fields into a text array (see Text Arrays).
- linescontain( -- checks to see if any line in a carriage return separated array matches the specified value.
- linesnotcontain( -- is the reverse of the linescontain( function.
- linesort( -- sorts lines of text in ascending order.
- linestrip( -- removes any blank lines from the text.
- listchoices( -- builds a text array containing a list of all the values stored in a specified field.
- listfiles( -- builds a text array listing the files in a folder.
- lookupall( -- builds a text array containing one item for every record in the target database where the data in the keyField matches the keyData. Each item in the text array contains the value extracted from the dataField for that record. If the data field is a numeric or date field, it is converted to text using the default patterns for that field.
- lookupalldouble( -- is similar to the lookupall( function, but it returns two fields from the target database instead of just one.
- lookupalloctet( -- is similar to the lookupall( function, but it returns eight fields from the target database instead of just one.
- lookupallquadruple( -- is similar to the lookupall( function, but it returns four fields from the target database instead of just one.
- lookupallquintuplet( -- is similar to the lookupall( function, but it returns five fields from the target database instead of just one.
- lookupallseptuplet( -- is similar to the lookupall( function, but it returns seven fields from the target database instead of just one.
- lookupallsextet( -- is similar to the lookupall( function, but it returns six fields from the target database instead of just one.
- lookupalltriple( -- is similar to the lookupall( function, but it returns three fields from the target database instead of just one.
- lower( -- converts text to lower case.
- mactoutf8 -- translates text from Panorama format to UTF8 (Unicode).
- makemergeformula( -- builds a formula from an “auto-wrap" style merge template.
- makenumberedarray -- generates a numeric sequenced text array.
- match -- checks to see if the text on the left matches the wildcard pattern specified on the right.
- matchexact -- checks to see if the text on the left matches the wildcard pattern specified on the right.
- max( -- compares a series of values and returns the largest value.
- md5( -- calculates the MD5 hash of a binary or text data item.
- mid( -- extracts characters from the middle of the text.
- min( -- compares a series of values and returns the smallest value.
- mixedupperword( -- converts lower case words to Initial Caps, but leaves mixed case words alone.
- naturaldate( -- converts a number representing a date into text using "natural" formatting.
- notbetween( -- checks to see if a value is *not* between two other values.
- notcontains -- returns true if the value on the left does not contain
the value on the right, false if it does.
- notmatch -- checks to see if the text on the left does not match the wildcard pattern specified on the right.
- notmatchexact -- checks to see if the text on the left doesn't match the wildcard pattern specified on the right.
- nth( -- converts a number into an ordinal.
- nthline( -- extracts the nth line from the text.
- nthword( -- extracts a word from the middle of the text.
- Numeric Patterns -- control how a number is displayed or converted to text.
- onespace( -- removes all leading & trailing spaces and any extra spaces between words, so that there is exactly one and only one space between each word.
- onewhitespace( -- removes all leading spaces and any extra whitespace between words, making sure that there is one and only one space between each word.
- padzero( -- makes the text a fixed width, padding on the left with zeros if necessary.
- pattern( -- converts a number into text using a pattern.
- percentescape( -- encodes specified characters using percent encoding.
- percentunescape( -- decodes text that contains percent encoding.
- perlscriptstring( -- converts text into a Perl string literal.
- places( -- converts a number to text with a specific number of places after the decimal point.
- quoted( -- returns a quoted version of the supplied text.
- radixstr( -- converts a number into a text item containing the equivalent number in a radix between 2 and 36.
- randomletter( -- returns a random letter.
- randomline( -- returns a random line from multiple lines of text.
- randomword( -- returns a random word from a list of words.
- rangecontains( -- checks to see if the text contains any characters in the specified range.
- rangematch( -- returns true (-1) if the text matches a specified range.
- rangenotmatch( -- returns false (0) if the text matches a specified range.
- regexarray( -- applies a regular expression to a text value, then builds an array containing all of the substrings that match the regular expression (see Regular Expressions).
- regexarrayexact( -- applies a regular expression to a text value, then builds an array containing all of the substrings that match the regular expression (see Regular Expressions).
- regexliteral( -- adds \ characters to text as necessary so that it can be used as a literal in a regular expression.
- regexmatch -- checks to see if the text on the left matches the regular expression on the right (see Regular Expressions).
- regexmatchexact -- checks to see if the text on the left matches the regular expression on the right (see Regular Expressions).
- regexreplace( -- replaces text with new text. The text to be replaced is determined by a regular expression.
- regexreplaceexact( -- replaces text with new text. The text to be replaced is determined by a regular expression.
- Regular Expressions -- Regular expressions can be used to look for a specified pattern in text and then specify what to do with each pattern match that is found
- removeprefix( -- checks to see if a text item starts with a prefix. if it does, the prefix is removed.
- removesuffix( -- checks to see if a text item ends with a suffix. if it does, the suffix is removed.
- rep( -- assembles a text item by repeating a smaller text item over and over again.
- replace( -- replaces text with new text.
- replacemultiple( -- replaces multiple words and phrases in a text value.
- replaceword( -- replaces a word with a new word.
- replacewordexact( -- replaces a word with a new word.
- richtextdata( -- adjusts text so that it will display properly in rich text even if it contains a < character.
- richtextdisplay( -- works with Text Display objects to display text with multiple styles, fonts, colors and alignments.
- right( -- extracts characters from the right edge of the text.
- sandwich( -- assembles a text item from three smaller items.
- scopes( -- returns the current scope of a variable, as well as any hidden scopes.
- search( -- searches through an item of text looking for a character, word or phrase. If it finds an exact match (including upper/lower case) with the character, word or phrase, it returns its position within the text item. If it does not find the character, word or phrase, it returns zero.
- searchanycase( -- searches through an item of text looking for a character, word or phrase. If it finds a match (upper/lower case may be different) with the character, word or phrase, it returns its position within the text item. If it does not find the character, word or phrase, it returns zero.
- setdefaultfloatformat -- sets the default format for converting floating point values to text (unsupported).
- setfieldproperties -- modifies one or more properties (name, data type, formula, etc.) of the current field.
- sha1( -- calculates the SHA-1 hash of a binary or text data item.
- sha256( -- calculates the SHA-256 hash of a binary or text data item.
- sha512( -- calculates the SHA-512 hash of a binary or text data item.
- snip( -- removes (snips!) one or more characters from the middle of an item of text.
- soundex( -- computes a four character code that roughly corresponds to the phonetic pronunciation of the word.
- soundslike -- compares two words to see if they "sound like" each other.
- stateabbreviations( -- returns a list of US state abbreviations.
- statelookup( -- converts a two letter abbreviation for a US state into the full state name.
- statename( -- converts a two letter abbreviation for a US state into the full state name.
- str( -- converts a number into text, with no formatting.
- straightquotes( -- converts any "smart quotes" in the text into straight quotes.
- stringreverse -- reverses the characters in a string of text. The original text is replaced *in situ*.
- stringreverse( -- reverses the order of a string of text characters.
- strip( -- strips off leading and trailing blanks and other whitespace (carriage returns, tabs, etc.)
- stripaccents( -- removes accents from any characters in the text.
- stripchar( -- extracts characters you don't want from a text item.
- stripdiacriticals( -- strips diacritical marks from text.
- striphtmltags( -- removes all HTML tags from the text.
- stripprintable( -- strips non-printable characters from text.
- striptoalpha( -- removes everything but alphabetic letters from a text item.
- striptonum( -- removes everything but numeric digits from a text item.
- superarraybuild -- scans a database to create a text array. This statement is is similar to arraybuild, but with a number of additional options (see Text Arrays).
- switchmatch( -- chooses from a list of values based on a wildcard match.
- switchmatchexact( -- chooses from a list of values based on a wildcard match.
- tab( -- generates a tab.
- tagparameterarray( -- extracts the value of multiple tag parameters embedded in some text, where each tag parameter takes the form *name=value*.
- Text Arrays -- A numbered collection of text values.
- Text Funnels -- Text funnels strip off the beginning and/or end of a text string based on your specifications.
- textafter( -- extracts the text after the tag.
- textbefore( -- extracts the text before the tag.
- textdisplay( -- works with Text Display Objects to control the color and style of text on the fly.
- textfilter( -- scans and filters text on a character by character basis.
- textstuff( -- replaces one or more characters in the middle of a piece of text.
- texttobinary( -- converts text into binary data, optionally using a specified encoding.
- time( -- converts text into a number representing a time.
- timepattern( -- converts a number representing a time into text. The function uses a pattern to control how the time is formatted.
- titlecase( -- capitalizes first character of each word, but not articles, prepositions, and conjunctions under 5 characters (unless they are the first or last word in the text).
- trim( -- removes characters from the right edge of the text.
- trimleft( -- removes one or more characters from the left edge of the text.
- trimstart( -- removes one or more characters from the start of the text.
- tsvtocsv( -- converts tab separated text into comma separated text.
- tsvtojson( -- converts tab separated text into JSON formatted text.
- upper( -- converts text to UPPER CASE (all caps).
- upperword( -- converts text to Initial Caps.
- urldecode( -- decodes text that contains percent encoded characters.
- urlencode( -- converts text into a legal URL (by converting spaces into `%20`). WARNING: THIS FUNCTION IS OBSOLETE.
- uspssecondaryunits( -- returns a list of USPS (United States Postal Service) secondary suffix designation abbreviations.
- uspsstreetsuffixes( -- returns a list of USPS street suffix abbreviations.
- utf8tomac -- translates text from UTF8 (Unicode) to Panorama format.
- utf8tomac( -- translates text from UTF8 (Unicode) into Panorama's native text format.
- val( -- converts text into a number.
- vtab( -- generates a vertical tab.
- vtabtocr( -- converts vertical tabs (ASCII 0x0B) into carrige returns (ASCII 0x0D).
- xtag( -- generates an HTML/XML tag.
- xtagvalue( -- extracts the text from the first matching HTML or XML tag.
- yoke( -- appends two text items together, with a joiner between them if both are non-blank.
- zbpattern( -- converts a number to text using a pattern, but returns empty text if the number is zero.
- zeroblank( -- tells Panorama to treat zeroes as empty space.
History
10.0 | No Change | Carried over from Panorama 6.0. |