Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternative to Val() Function
Message
De
09/06/1998 05:58:51
 
 
À
08/06/1998 16:30:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00106049
Message ID:
00106221
Vues:
27
>Hello:
>
>I'm debugging some code that won't pick up codes that have
>non-numeric characters in them. The code uses the val() function
>which returns numeric values from a character expression composed of numbers. Is there an alternative function that I'm missing that will
>pick up both numeric and non-numeric codes?. My code is as follows:
>
>With thisform.list1
>.boundcolumn = 2
>.columncount = 2
>.columnwidths = "570,0"
>.controlsource = "new_course"
>.rowsourcetype = 3
>
>Do case
>Case val(right(new_course,4) = 0
>.rowsource = "select desc_e, code from studies;
>where right(code,5) = '0';
>and left(new_course,2) = left(code,2) into cursor course3;
>select course3
>
>This works fine but is there is a code with a letter included it will
>list in my listbox but won't select.
>Any help would be greatly appreciated.
>Thank oyu.

Hello Sheena,

Try to use the STR_keep() function of FOCUS.FLL (don't forget to download the documentation also, and the KERNEL.DLL (it's needed by FOCUS.FLL)).

The STR_keep() function processes a string and keeps only the wanted characters : STR_keep( AnyString,"0123456789." ) will only retain the digits and the decimal separator.

You can also use the STR_dionly() (which stands for Digits Only) of FOCUS.FLL : it has the same effect as STR_keep() although the decimal separator is not treated then.

You can download FOCUS.FLL from the Files section.

Pat
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform