Main Content



Set value of parameter in field


field = setParameter(field,name,value)


field = setParameter(field,name,value) sets the value of the parameter name and returns the modified field.

The returned field.Value might be reformatted to remove extraneous whitespace in the original value.

Input Arguments

expand all

Header field, specified as a object.

Parameter name, specified as a string or a character vector.

The name must be a valid token, containing only characters defined in RFC 7230 Field Value Components, section 3.2.6 on the Internet Engineering Task Force (IETF®) website. To set an unnamed parameter, use "" or ''.

Name matching is not case-sensitive, but value is case-sensitive. If name matches an existing parameter, but with a different case, then the parameter name is changed to the case of the specified name.

If there are multiple matching parameters, then all are changed to value.

Parameter value, specified a string or character vector. value can contain any characters. If it contains characters not allowed in a token, and is not already quoted, the method adds quotes. An empty string is inserted as paired double-quotes ("").

Version History

Introduced in R2018a