Takes a string and turns it into a base-64 Unicode string : UTF8Encoding « Internationalization I18N « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# / C Sharp » Internationalization I18N » UTF8EncodingScreenshots 
Takes a string and turns it into a base-64 Unicode string
   
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;

namespace FStore.Utils
{
    /// <summary>
    /// Class containing utilities used internally and available for external use
    /// </summary>
    public static class PublicUtils
    {
        /// <summary>
        /// Takes a string and turns it into a base-64 Unicode string
        /// </summary>
        /// <param name="data">The string to convert to base-64</param>
        /// <returns>The base-64 string</returns>
        public static string UAsBase64(this string data)
        {
            return UAsBase64(data, Encoding.Unicode);
        }

        /// <summary>
        /// Takes a string and turns it into a base-64 string of a given encoding
        /// </summary>
        /// <param name="data">The string to convert to base-64</param>
        /// <param name="enc">The encoding to use</param>
        /// <returns>The base-64 string</returns>
        public static string UAsBase64(this string data, Encoding enc)
        {
            return Convert.ToBase64String(enc.GetBytes(data));
        }
    }

}

   
    
    
  
Related examples in the same category
1.Create UTF8Encoding class
2.Create UTF8Encoding, specify whether to provide a Unicode byte order mark
3.UTF8Encoding Class
4.Initializes a new instance of the UTF8Encoding class.
5.Determines whether the specified Object is equal to the current UTF8Encoding object.
6.Calculates the number of bytes produced by encoding a set of characters from the specified character array.
7.Calculates the number of bytes produced by encoding the characters in the specified String.
8.Encodes a set of characters from the specified character array into the specified byte array.
9.Encodes a set of characters from the specified String into the specified byte array.
10.Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
11.Decodes a sequence of bytes from the specified byte array into the specified character array.
12.converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.
13.Converts a sequence of Unicode characters into a UTF-8 encoded sequence of bytes.
14.Returns the hash code for the current instance.
15.Calculates the maximum number of bytes produced by encoding the specified number of characters.
16.Calculates the maximum number of characters produced by decoding the specified number of bytes.
17.Returns a Unicode byte order mark encoded in UTF-8 format
18.Convert the passed string to a UTF8 byte array
19.Convert string to byte array back and forth with Encoding.UTF8
20.Convert a string to a Byte Array in UTF8 encoding.
21.Ptr To String Utf8
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.