CryptographicBuffer.ConvertStringToBinary | convertStringToBinary method

Applies to Windows and Windows Phone

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

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

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

Metadata

Windows.winmd

See also

CryptographicBuffer

 

 

Show:
© 2014 Microsoft