CryptographicBuffer.ConvertStringToBinary | convertStringToBinary method

0 out of 1 rated this helpful - Rate this topic

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

Windows.Security.Cryptography
Windows::Security::Cryptography [C++]

Metadata

Windows.winmd

See also

CryptographicBuffer

 

 

Build date: 12/4/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.