Converts a string to an encoded buffer.
Syntax
var iBuffer = Windows.Security.Cryptography.CryptographicBuffer.convertStringToBinary(value, encoding);
Parameters
- value
-
Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]
String to be encoded.
- encoding
-
Type: BinaryStringEncoding
Encoding format.
Return value
Type: IBuffer
Encoded buffer.
Examples
public void ConvertData()
{
// Create a string to convert.
String strIn = "Input String";
// Convert the string to UTF16BE binary data.
IBuffer buffUTF16BE = CryptographicBuffer.ConvertStringToBinary(strIn, BinaryStringEncoding.Utf16BE);
// Convert the string to UTF16LE binary data.
IBuffer buffUTF16LE = CryptographicBuffer.ConvertStringToBinary(strIn, BinaryStringEncoding.Utf16LE);
// Convert the string to UTF8 binary data.
IBuffer buffUTF8 = CryptographicBuffer.ConvertStringToBinary(strIn, BinaryStringEncoding.Utf8);
}
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012