![]() | Programming Guide | ![]() |
Strips non-digit characters from a string
char *sm_strip_amt_ptr(int field_number, char *inbuf);char *sm_e_strip_amt_ptr(char *field_name, int element, char *inbuf);char *sm_i_strip_amt_ptr(char *field_name, int occurrence, char *inbuf);char *sm_n_strip_amt_ptr(char *field_name, char *inbuf);char *sm_o_strip_amt_ptr(int field_number, int occurrence, char *inbuf);
field_name, field_number- The field with the string to strip. You must also set parameter
inbuftoNULL. For example, this JPL statement puts the unformatted contents of fieldsale_amtinto variableamt:vars amt
amt = sm_n_strip_amt_ptr("sale_amt", @NULL)If
inbufcontains the string to strip, supply this parameter with an argument ofNULL.element- The element with the string to strip.
occurrence- The occurrence with the string to strip.
inbuf- Contains the string to strip. For example, this JPL statement strips the supplied string of its currency symbol and comma and puts
123489.12intoamt:amt = sm_strip_amt_ptr(@NULL, "$123,489.12")To use the data in
field_name/field_number, supplyNULL.
- · A pointer to a string that contains the stripped text.
- · 0 if
inbufis set toNULLand the field number is invalid.
sm_strip_amt_ptrstrips all leading zeros and non-digit characters from the string, except for an optional leading minus sign and decimal point. If you supply a value forinbufsm_strip_amt_ptrprocesses its contents. Otherwise, it uses the field data.This function identifies the decimal character to preserve from the widget's decimal_symbol property. If this property is not set,
sm_strip_amt_ptruses the character that is set by the message file'sSM_DECIMALentry (refer to "Decimal Symbols" in Application Development Guide).Note:
sm_strip_amt_ptrstores its return value in a pool of buffers that it shares with other functions. Consequently, you should use this data immediately.