Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

FIELDS

Description

The FIELDS function is an extension of the FIELD function. It returns a dynamic array of multicharacter delimited fields from a dynamic array of strings. It takes the general form: 

FIELDS(DynArr, Delimiter, Occurrence{, ExtractCount})

Where: 

DynArr should evaluate to a dynamic array. 

Delimiter specifies the character or characters that delimit the fields within the dynamic array. 

Occurrence should evaluate to an integer of value 1 or higher. It specifies the delimiter used as the starting point for the extraction. 

ExtractCount is an integer that specifies the number of fields to extract. If omitted, assumes one.

If the emulation option, jbase_field, is set then the field delimiter may consist of more than a single character, allowing fields to be delimited by complex codes. 

An example of use would be a program that shows how each element of a dynamic array can be changed with the FIELDS function, as: 

t = ""
t<1> = "a:b:c:d:e:f"
t<2> = "aa:bb:cc:dd:ee:ff" : @VM: "1:2:3:4" : @SVM: ":W:X:Y:Z"
t<3> = "aaa:bbb:ccc:ddd:eee:fff":@VM:@SVM
t<4> = "aaaa:bbbb:cccc:dddd:eeee:ffff"
r1 = FIELDS(t,":",2)
r2 = FIELDS(t,":",2,3)
r3 = FIELDS(t,"bb",1,1)


to create three dynamic arrays.


Go back to jBASE BASIC.


Was this article helpful?