SetValueTime
Description
Sets the time value for a key. If the key does not exist, then
create the key and set its value. If the key already exists, then
overwrite the value of this key. If more than one key with the same name
already exists, then overwrite the value of the first key. Notice that the
IgnoreCase property (true by default) determines whether the key name will
be matched in a case-sensitive manner.
Applies to
Syntax
|
1 |
objectname.SetValueTime ( Key, Value ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the JSONPackage object. |
|
Key |
A string specifying the key name. |
|
Value |
A time specifying the key value. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any
argument’s value is null, the method returns null.
Examples
This example modifies the value of the endtime key in the JSON
string, from 21:02:30 to 23:59:59.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// Integer SetValueTime ( string Key, time Value ) Time lt_EndTime Integer li_Return JsonPackage ljpk_User ljpk_User = Create JsonPackage // Loads the JSON string to the JSONPackage object ljpk_User.loadstring ( '{"id":100, "name":"Henry.Ken", "starttime":"08:02:30", "endtime":"21:02:30" }') li_Return = ljpk_User.SetValueTime ("endtime", 23:59:59.325) If li_Return = 1 Then lt_EndTime = ljpk_User.GetValueTime ("endtime") // Gets the value of endtime: lt_EndTime=23:59:59 Else // Prints the error message End If |
See also