Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Slim Code - List of Shortcuts?
Message
From
02/07/2010 16:39:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
01/07/2010 11:53:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01471199
Message ID:
01471328
Views:
84
>Does anyone know where I can find I big list of shortcut functions/coding syntax to help slim down the code making it smaller and/or neater?
>
>For example:
>
>
>IF test = X .or. test = Y .or. test = Z    could be  IF INLIST(test,X,Y,Z) 
>or
>IF LEN(ALLTRIM(test)) = 0  could be IF EMPTY(test)
>
>
>There are always some we either don't know about, or haven't used in a long time and forget about...

Here is another neat shortcut that I just remembered.

Sort in a specified sequence that depends on letter codes, which are not in alphabetical order (for example, S, M, L, X for small, medium, large, eXtra large):
select *, at(SizeCode, "SMLX") as OrderKey;
  ...
For larger groups of letters, you can use the wordcount functions in a similar way (use it to return a position), or used a fixed width. For example, to get the number of a month based on a 3-letter abbreviation.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform