Encodes characters from the specified character array into the specified byte array. : ASCIIEncoding « Internationalization I18N « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net » Internationalization I18N » ASCIIEncodingScreenshots 
Encodes characters from the specified character array into the specified byte array.
 

Imports System
Imports System.Text

Class ASCIIEncodingExample

    Public Shared Sub Main()
        Dim bytes() As Byte
        Dim chars As String = "ASCII Encoding Example"

        Dim ascii As New ASCIIEncoding()

        Dim byteCount As Integer = ascii.GetByteCount(chars.ToCharArray()68)
        bytes = New Byte(byteCount - 1) {}
        Dim bytesEncodedCount As Integer = ascii.GetBytes(chars, 68, bytes, 0)

        Console.WriteLine("{0} bytes used to encode string.", bytesEncodedCount)

        Dim As Byte
        For Each b In bytes
            Console.Write("[{0}]", b)
        Next b
    End Sub
End Class

   
  
Related examples in the same category
1.ASCIIEncoding Class represents an ASCII character encoding of Unicode characters.
2.ASCIIEncoding Class Represents an ASCII character encoding of Unicode characters.
3.Decode bytes back to string
4.Get positions of the special characters
5.Create ASCIIEncoding class.
6.ASCIIEncoding.GetByteCount calculates the number of bytes produced by encoding a set of characters
7.ASCIIEncoding.GetByteCount (String)
8.Encodes characters from the specified String into the specified byte array.
9.Calculates the number of characters produced by decoding bytes
10.Decodes bytes into the specified character array.
11.Calculates the maximum number of bytes produced by encoding the specified number of characters.
12.Calculates the maximum number of characters produced by decoding the specified number of bytes.
13.Decodes a range of bytes from a byte array into a string.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.