Description

Use to replace, delete, or insert substrings in a string.

Syntax

result = FieldStore (source_string, delimiter, occurrence, field, string)

Parameters

The FieldStore function has the following parameters.

ParameterDescription
source_stringSpecifies the string that is to be searched, then modified.
DelimiterAny single ASCII character including field, value, or subvalue marks. This value determines what constitutes a "field" in the values of both source_string and string.
OccurrenceProcessing starts at the ordinal substring designated by occurrence. The value of delimiter determines the end of each "field." If the number of substrings within source_string is less than the value of occurrence, source_string will be padded with the necessary number of null substrings, before FieldStore is executed.
Field

Specifies the number of substrings in string to apply to source_string. As with source_string, the value of delimiter determines the end of a substring. The value of field determines the operation insource_string.

ValueDescription
Positive numberMoves that number of substrings from string to source_string.
0Inserts the entire string in source_string. The insertion occurs at the substring indicated by occurrence.
Negative numberInserts the entire string in source_string. The field specifies the number of substrings to replace in source_string.
StringContains the new string values to store in source_string.

See also

Field()Replace()

Example

/* The following routine changes a phone number, where the area code remains the same. */
source  = '206-111-2222'   ;* old number
delimiter = '-'
occur   = 2     ;* start with 2nd field
field   = 2     ;* replace 2 fields
string  = '333-4444'    ;* new number
new_number = FieldStore (source, delimiter, occur, field, string)
  • No labels