# AddOrReplaceInKeyValues
`AddOrReplaceInKeyValues(KeyValues, Key, Value)`
`KeyValues`-`{Collection}`
`Key`-`{String}`
`Value`-`{Variant}`
Helper用于在`KeyValue`的`Collection`中添加/替换`KeyValue`
* 如果找不到key则添加
* 如果找到key则替换
~~~vb
Dim KeyValues As New Collection
KeyValues.Add WebHelpers.CreateKeyValue("a", 123)
KeyValues.Add WebHelpers.CreateKeyValue("b", 456)
KeyValues.Add WebHelpers.CreateKeyValue("c", 789)
WebHelpers.AddOrReplaceInKeyValues KeyValues, "b", "abc"
WebHelpers.AddOrReplaceInKeyValues KeyValues, "d", "def"
'// -> [
'// {"Key":"a","Value":123},
'// {"Key":"b","Value":"abc"},
'// {"Key":"c","Value":789},
'// {"Key":"d","Value":"def"}
'// ]
~~~
- README
- 指南
- 概述
- GET Request
- WebRequest
- 属性
- Resource
- Method
- Body
- Format
- RequestFormat
- ResponseFormat
- CustomRequestFormat
- CustomResponseFormat
- ContentType
- Accept
- ContentLength
- FormattedResource
- Cookies
- Headers
- QuerystringParams
- UrlSegments
- 方法
- AddHeader
- SetHeader
- AddUrlSegment
- AddQuerystringParam
- AddCookie
- AddBodyParameter
- CreateFromOptions
- WebClient
- 属性
- BaseUrl
- Authenticator
- TimeoutMs
- ProxyServer
- ProxyBypassList
- ProxyUsername
- ProxyPassword
- EnableAutoProxy
- Insecure
- FollowRedirects
- 方法
- Execute
- GetJson
- PostJson
- SetProxy
- GetFullUrl
- WebResponse
- 属性
- StatusCode
- StatusDescription
- Content
- Data
- Body
- Headers
- Cookies
- 方法
- Update
- WebHelpers
- 属性
- WebStatusCode
- WebMethod
- WebFormat
- UrlEncodingMode
- EnableLogging
- 方法
- LogDebug
- LogWarning
- LogError
- LogRequest
- LogResponse
- Obfuscate
- ParseJson
- ConvertToJson
- ParseUrlEncoded
- ConvertToUrlEncoded
- ParseXml
- ConvertToXml
- ParseByFormat
- ConvertToFormat
- UrlEncode
- UrlDecode
- Base64Encode
- Base64Decode
- RegisterConverter
- JoinUrl
- UrlParts
- CloneDictionary
- CloneCollection
- CreateKeyValue
- FindInKeyValues
- AddOrReplaceInKeyValues
- FormatToMediaType
- MethodToName
- HMACSHA1
- HMACSHA256
- MD5
- CreateNonce
- IWebAuthenticator
- 方法
- BeforeExecute
- AfterExecute
- PrepareHttp
- PrepareCurl
- WebAsyncWrapper
- 属性
- Client
- 方法
- ExecuteAsync
- 范例
- Salesforce网站
- Google APIs
- Todoist API
- 其他主题
- 调试
- 授权
- 实现自己的IWebAuthenticator
- Url编码