SetPropertyString()
Sets the value of a property entry in a properties file.
Introduced: 7.0.0.108
SetPropertyString( filePath=string, key=string, value=string, encoding=string );
Returns: String
| Argument | Description | Default |
|---|---|---|
|
filePath
string,
required
|
edit
Path of the properties initialization file |
|
|
key
string,
required
|
edit
Name of the key to set |
|
|
value
string,
required
|
edit
Value to which to set the property |
|
|
encoding
string,
optional
|
edit
Encoding for the properties file, default UTF-8 |
UTF-8 |
Examples
edit// Define the path to your properties file
path = expandPath("/path/to/your/test.properties");
// Set the value of the 'lucee' property to '8888' using UTF-8 encoding
setPropertyString(path, "lucee", "8888", "UTF-8");
// Read back the property to verify it was set
propertyValue = getPropertyString(path, "lucee", "UTF-8");
writeOutput("lucee property value: " & propertyValue);
See also
- File handling
- GetPropertyFile()
- GetPropertyString()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)