• 簡體、繁體轉換方法


    CREATE FUNCTION [dbo].[Convert_Str] (@Str nvarchar(4000),@ToBIG bit)   --------------@Str:要轉換的字符串.ToBIG 转换标志,为1,表示 GB-->BIG,否则是 BIG-->GB
    RETURNS nvarchar(4000) AS
    BEGIN
       declare @returnStr varchar(4000),@index int,@repChar nchar(1),@indexChar nchar(1) --@Str字符串對應的每個字符

    set @returnStr=''

    set @index = 1
    --循環取得轉換字符串的每個值
    while @index <= Len(@str)
    begin
          set @repChar = ''   --- 記得每次循環前要置@repChar為空
          set @indexChar = SubString(@Str,@index,1)
         
       
    /*------------------------------------------得出取個字符對應的轉換字符---------------------------------------------------------*/
           if @toBIG=1 --轉為繁體
                     select @repChar=IsNull(replace(@indexChar,GBField,BIGField) ,@indexChar)
                     from CodeConvert_ccv
                     where GBField = @indexChar
               else
                     select @repChar=IsNull(replace(@indexChar,BIGField,GBField),@indexChar)   --轉為簡體
                     from CodeConvert_ccv
                     where BIGField = @indexChar

    /*---------------------------------------------------------- 取字符結束-------------------------------------------------------------------------*/
    set @index = @index+1

    if @repChar=''
        set @returnStr = @returnStr + @indexChar
    else
        set @returnStr = @returnStr + @repChar
    end
    return (@returnStr)
    END

  • 相关阅读:
    Vue 数组响应
    Vue 事件监听
    Vue 分支循环
    Vue 计算属性与方法
    Vue 属性与样式
    Vue mustache语法&常用指令
    vue 基本介绍
    linux(centos7) 安装nginx
    python 创建虚拟环境(一个独立的环境)
    Python标准库学习--->1、内置函数(1-10个)
  • 原文地址:https://www.cnblogs.com/guyuehuanhuan/p/1942285.html
Copyright © 2020-2023  润新知