Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SET POINT, Set(“Point”), SET SEPARATOR, Set(“Separator”)

These commands control the characters used for the decimal point and to separate groups of digits.

Usage

SET POINT TO [ cPointChar ]
cPointChar = SET( "POINT" )
SET SEPARATOR TO [ cSeparatorChar ]
cSeparatorChar = SET( "SEPARATOR" )

SET POINT controls the decimal point. SET SEPARATOR controls the character that goes between groups of digits (when you format a number that way). In the default U.S. setup, the point character is “.” while the separator is “,”. In much of the rest of the world, they use exactly the opposite.

Regardless of these settings, you must do it the U.S. way in code. Any numeric constants use a period for the decimal point. InputMasks use “.” and “,” for the decimal point and separator, respectively. (The “.” and “,” get translated to the appropriate POINT and SEPARATOR characters when you run the form.) While this is no doubt annoying to non-Americans writing code, it is actually a sensible choice. The point and separator characters can be changed many ways—you wouldn’t want the interpretation of code to depend on the current settings. (There’s a similar problem with date constants. They’re interpreted according to the SET DATE setting when the code is compiled, not when it’s executed.)

These two settings respect SET SYSFORMATS. When that setting is ON, they draw their values from the Windows settings. Otherwise, they use the established FoxPro settings (the defaults or those saved in the Registry or specified in a Config.FPW file). However, if you SET SYSFORMATS OFF, SET POINT and SET SEPARATOR do not revert to their FoxPro defaults. You have to issue SET POINT TO and SET SEPARATOR TO to restore the defaults.

Example

* set up European settings
SET POINT TO ","
SET SEPARATOR TO "."

See Also

Configuration Files, InputMask, Set, Registration Database, Set SysFormats