WSHelper.SplitQueryString

Splits the query string of a URL into an array or key-value pairs.

Syntax

SplitQueryString( 
   query STRING )
  RETURNS WSHelper.WSQueryType
  1. query is the query string to be split into a dynamic array.

Usage

Split a given query string into a dynamic array of key-value pairs, defined as WSHelper.WSQueryType.

The pieces are returned in dynamic array of key-value pairs defined as a WSHelper.WSQueryType. See WSHelper variables and records for more information regarding WSQueryType.

NULL may be returned if a value is not found.

In case of error, a NULL value will be returned.

WSHelper functions example

IMPORT FGL WSHelper

MAIN

DEFINE val, scheme, host, port, path, query STRING
DEFINE ind INTEGER
DEFINE ret WSHelper.WSQueryType

CALL WSHelper.SplitQueryString("name1=val1&name2=val2&name3=val3")
  RETURNING ret

FOR ind = 1 TO ret.getLength()
  DISPLAY "Query",ind
  DISPLAY " name is",ret[ind].name
  DISPLAY " value is ",ret[ind].value
END FOR

LET val = WSHelper.FindQueryStringValue("name1=val1&name2=val2","name1")

CALL WSHelper.SplitUrl("https://cube.strasbourg.4js.com:3128/GWS-492/TestSplitURL/test1")
  RETURNING scheme, host, port, path, query

END MAIN
Output:
Query          1
 name isname1
 value is val1
Query          2
 name isname2
 value is val2
Query          3
 name isname3
 value is val3