zoukankan      html  css  js  c++  java
  • 简体与繁体转换

    简体与繁体转换


    using System;
    using System.Collections.Generic;
    using Microsoft.VisualBasic;
    using System.Runtime.InteropServices;
    using System.Text;
    
    namespace Micro.Common
    {
        public static class Chinese
        {
            internal const int LOCALE_SYSTEM_DEFAULT = 0x0800;
            internal const int LCMAP_SIMPLIFIED_CHINESE = 0x02000000;
            internal const int LCMAP_TRADITIONAL_CHINESE = 0x04000000;
    
            [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
            internal static extern int LCMapString(int Locale, int dwMapFlags, string lpSrcStr, int cchSrc, [Out] string lpDestStr, int cchDest);
    
            public static string ToSimplified(string source)
            {
                String target = new String(' ', source.Length);
                int ret = LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_SIMPLIFIED_CHINESE, source, source.Length, target, source.Length);
                return target;
            }
    
            public static string ToTraditional(string source)
            {
                String target = new String(' ', source.Length);
                int ret = LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_TRADITIONAL_CHINESE, source, source.Length, target, source.Length);
                return target;
            }
        }
    }
    
  • 相关阅读:
    codeforce 896A
    CQH分治与整体二分
    [CQOI2011]动态逆序对
    codeforce Hello 2018 913F sol
    A*算法[k短路([SDOI2010]魔法猪学院)]
    bzoj3524 [POI2014]Couriers
    整体二分
    bzoj5016 [SNOI2017]一个简单的询问
    CF176E Archaeology
    bzoj4551 [TJOI2016&HEOI2016]树
  • 原文地址:https://www.cnblogs.com/sntetwt/p/9857860.html
Copyright © 2011-2022 走看看