Visual FoxPro/PHP Functions In Lianja
Có thể bạn quan tâm
Lianja has a complete cross-platform Visual FoxPro scripting language implementation built-in. The Visual FoxPro implementation has many functions and language extensions not available in Visual FoxPro 9. For example, The following PHP functions (which will be familiar to PHP developers) are built-in and can be used by Visual FoxPro developers. Some of these functions are available by a different name in Visual FoxPro but are included to make it easier for PHP developers to develop in Lianja Scripting which unlike PHP is a data-centric scripting language.
Note that you can write your code directly in PHP if that's what you want to do as Lianja is scripting language independent and fully supports Visual FoxPro, Python, PHP and JavaScript
| Function | Arguments | Returns | Description |
|---|---|---|---|
| strcmp(string1, string2) | string1 as Character string2 as Character | Numeric | Compare two character expressions |
| strcasecmp(string1, string2) | string1 as Characterstring2 as Character | Numeric | Compare two character expressions case insensitive |
| strpos(haystack, needle ) | haystack as Characterneedle as Character | Numeric | Returns the position of a substring (needle) in a string (haystack) |
| strlen( string ) | string as Character | Numeric | Returns the length of a string |
| unset( name ) | name as Variable | None | Releases a memory variable |
| isset( name ) | name as Variable | Logical | Tests for the existence of a memory variable |
| die( message ) | message as Character | None | Used to exist a .rsp page and output the epecified message |
| exit( returncode ) | returncode as Numeric | None | Used to exit the process |
| array( ) | None | Dynamic Array | Creates an empty dynamic (associative) array |
| base64_encode( expC ) | expC as Character | Character | Creates a bas64 encoded string |
| base64_decode( expC ) | expC as Character | Character | Decodes a base64 string |
| filesize( filename ) | filename as Character | Numeric | Returns the size of the specified filename |
| function_exists( name ) | name as Character | Logical | Returns true if the specified function name exists |
| print_r( name ) | name as Object | None | Outputs the specified object in human readable form |
| str_replace( needle, replace, haystack ) | needle as Characterreplace as Characterhaystack as Character | Character | Replaces the string "needle" with the specified "replace" string in the given string "haystack" |
| strtolower( string ) | string as Character | Character | Converts a string to lower case |
| strtoupper( string ) | string as Character | Character | Converts a string to upper case |
| ucfirst( string ) | string as Character | Character | Returns a "proper" word with first character upper case |
| str_pad( string, length [, padchar] ) | string as Characterlength as Numericpadchar as Character | Character | Returns a string padded to "length" by the "padchar" |
| html_entities( string ) | string as Character | Character | HTML encodes the given string |
| html_entity_decode( string ) | string as Character | Character | HTML decodes the special encoded HTML characters |
| require( filename ) | filename as Character | None | Includes a text file at the given point in the file |
| require_once( filename ) | filename as Character | None | Includes a text file at the given point in the file if it has not yet been included |
| include( filename ) | filename as Character | None | Includes a text file at the given point in the file |
| include_once( filename ) | filename as Character | None | Includes a text file at the given point in the file if it has not yet been included |
| strftime( format [, datetime] ) | format as charactervalue as datetime | Character | Returns the specified datetime or the current date and time formatted as specified by the given format |
| is_array( exp ) | exp as Expr | Logical | Returns true if the given expression is an array |
| is_object( exp ) | exp as Expr | Logical | Returns true if the given expression is an object |
| is_string( exp ) | exp as Expr | Logical | Returns true if the given expression is an string |
| is_int( exp ) | exp as Expr | Logical | Returns true if the given expression is an int |
| is_float( exp ) | exp as Expr | Logical | Returns true if the given expression is an float |
| wordwrap( string [, line_width [, break_char [, cut ] ] ] ) | string as Characterline_width as Numericbreak_char as CharacterCut as Logical | Character | Wraps a string to given line width (defaults to 80) |
| implode( separator, arrayname) | separator as Characterarrayname as Array | Character | The implode() function returns a string from the elements of an array |
| explode( separator, string) | separator as Characterstring as Character | Array | The explode() function breaks a string up into an array |
Additionally Lianja includes many functions and/or extensions to functions not available in Visual FoxPro 9. Below is a brief list of these. Browse through the documentation for the complete list as there are many more.
| Function | Arguments | Returns | Description |
|---|---|---|---|
| fopen( url ) | url as Character | Numeric | The fopen() function can be used to open:http://www.xxx.com/page URL'sandlinux fifo pipes with fifo://pipename. Use fputs(), fgets(), fflush(), fread(), fclose() with this function |
| printf( format [, args...]) | format as Characterargs as variable Expr list | None | C-style printf(). |
| sprintf( format [, args...]) | format as Characterargs as variable Expr list | Character | C-style sprintf(). |
| fprintf( fp, format [, args...]) | fp as Numericformat as Characterargs as variable Expr list | Numeric | C-style fprintf(). |
| fsockopen(hostname, port) | hostname as Characterport as Numeric | Numeric | TCP/IP socket function. Use fputs(), fgets(), fflush(), fread(), fclose() with this function |
| print_html( expO ) | expO as Object | None | Outputs an object or dynarray variable as html. Primarily used in .rsp pages. |
| print_xml( expO ) | expO as Object | None | Outputs an object or dynarray variable as xml.Primarily used in .rsp pages. |
| print_json( expO ) | expO as Object | None | Outputs an object or dynarray variable as json.Primarily used in .rsp pages. |
| array( [ arglist ] ) | Optional comma separated list of args in the following format:key=>value [, key=>value]... | Dynamic Array | Create a dynamic array |
| object( [ arglist ] ) | Optional comma separated list of args in the following format:key=>value [, key=>value]... | Object | Create an anonymous object |
| pipetostr( commands ) | commands as CharacterFormat of piped commands is: "commands | like | this" | Character | Run commands (optionally piped together) and return the output |
| saveobject(name, filename) | name as Objectfilename as Character | Logical | Save an object or dynarray to an external .obf file (object serialization) |
| loadobject(filename) | filename as Character | Object | Load an object or dynarray from an external .obf file (object deserialization) |
| timeofday( [mode] ) | mode as numeric | Numeric | Time function with msecs granularity |
| xml_encode(name [, arglist]) | name as ObjectOptional arguments:[, roottagname as character,rowtagname as character] | Character | Encodes an object or as an XML string |
| xml_decode(xml [, arglist]) | xml as character Optional arguments:[, roottagname as character, rowtagname as character] | Object | Decodes an XML string to an object |
| xml_scatter( [workarea] ) | Optional argument: [workarea as Numeric] | Character | Scatters the current record creating an XML string |
| xml_gather( xml ) | xml as Character | Numeric | Updates the current record by decoding the specified XML string |
Special notes
The format for printf(), sprintf() and fprintf() can contain any of the following formatting characters.
%s %d %f %y %t %T %l %L. Each formatting character sequence can optionally contain a width and decimal places (only relevant for numeric). Left justify by placing a '-' directly following the '%' character e.g. %-20s or %-14.2f. When %s is specified, the corresponding argument is converted to character format (similar to specifying etos(). %t and %T are for formating datetime data types. %y is for formatting currency data types %l and %L is for formatting logical datatypesThe format for the strftime() function can contain any of the following formatting characters.
%a - abbreviated weekday name%A - full weekday name%b - abbreviated month name%B - full month name%c - preferred date and time representation%C - century number (the year divided by 100, range 00 to 99)%d - day of the month (01 to 31)%D - same as %m/%d/%y%e - day of the month (1 to 31)%g - like %G, but without the century%G - 4-digit year corresponding to the ISO week number (see %V)%h - same as %b%H - hour, using a 24-hour clock (00 to 23)%I - hour, using a 12-hour clock (01 to 12)%j - day of the year (001 to 366)%m - month (01 to 12)%M - minute%n - newline character%p - either am or pm according to the given time value%r - time in a.m. and p.m. notation%R - time in 24 hour notation%S - second%t - tab character%T - current time, equal to %H:%M:%S%u - weekday as a number (1 to 7), Monday=1. Warning: In Sun Solaris Sunday=1%U - week number of the current year, starting with the first Sunday as the first day of the first week%V - The ISO 8601 week number of the current year (01 to 53), where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week%W - week number of the current year, starting with the first Monday as the first day of the first week%w - day of the week as a decimal, Sunday=0%x - preferred date representation without the time%X - preferred time representation without the date%y - year without a century (range 00 to 99)%Y - year including the century%Z or %z - time zone or name or abbreviation%% - a literal % character
Từ khóa » Visual Foxpro At Function
-
AT(), ATC(), RAT(), $ | Hacker's Guide To Visual FoxPro
-
AT() - dexOf() - VFP To Servoy Code Reference
-
ATC( ) Function - Yaldex
-
String Functions (Visual FoxPro ODBC Driver) - Microsoft Docs
-
FoxPro String And Text Functions - Alvechurch Data
-
Visual FoxPro Functions For Processing Text - Alvechurch Data
-
[PDF] FoxPro Functions - NC School Bus Safety
-
String Processing With VFP - CODE Magazine
-
At Function - Microsoft: FoxPro - Tek-Tips
-
Different Type Of Microsoft Visual FoxPro 6.0 Function - Samasto
-
Year Function
-
Functions And Subroutines (Procedures) | Visual FoxPro ...
-
Left(), Right(), SubStr() - Ted Roche
-
Text And String Handling In VFP | Steven Black Consulting