如何检查韩语? – PROGRESS 4GL

huangapple go评论51阅读模式
英文:

How to check Korean language? - PROGRESS 4GL

问题

以下查询帮助我查找中文字符,但如何查找韩文字符?

英文:

Below query is helping me to find out Chinese characters but how can we find Korean characters?


   Procedure check_chinese :
   Define input  parameter     m_char      as Character no-undo.
   define output parameter     m_error     as logical   no-undo.
   Define variable             m_ret       as Character no-undo.
   Define variable             i           as Integer no-undo.


   do i = 1 to length(m_char,"raw"):
      if ( (asc(substring(m_char,i,1,"raw")) >= 97 and
          asc(substring(m_char,i,1,"raw")) <= 122) ) 
   or ((asc(substring(m_char,i,1,"raw")) >= 65 and
          asc(substring(m_char,i,1,"raw")) <= 90))
      and (asc(substring(m_char,i,1,"raw")) <> 32 ) 
          then 
   do:
    m_error = yes.
    leave.
   
end.

答案1

得分: 1

假设您的会话内部代码页是 utf-8,您可以在 longchar 变量上修复代码页,将输入复制到该变量并在分配时捕获错误。我还假设 CP949 是适用于韩文的代码页。

function isKorean returns logical (
   i_lc as longchar
):

   def var lresult as logical no-undo initial true.
   def var lc as longchar no-undo.
   
   fix-codepage( lc ) = 'CP949'.
   
   do on error undo, throw:
   
      copy-lob from i_lc to lc.

      catch e as progress.lang.error:

         if e:getMessageNum(1) = 11395 then
            lresult = false.
         else 
            undo, throw e.
            
      end catch.
         
   end.
   
   return lresult.

end function.


message
   '说説' '~t' isKorean( '说説' ) skip
   '한국어 ' '~t' isKorean( '한국어 키보드' )
view-as alert-box.
英文:

Assuming that your session internal code page is utf-8, you can fix the codepage on a longchar variable, copy your input to it and trap an error when assigning. I am also assuming that CP949 is a suitable codepage for Korean.

function isKorean returns logical (
   i_lc as longchar
):

   def var lresult as logical no-undo initial true.
   def var lc as longchar no-undo.
   
   fix-codepage( lc ) = 'CP949'.
   
   do on error undo, throw:
   
      copy-lob from i_lc to lc.

      catch e as progress.lang.error:

         if e:getMessageNum(1) = 11395 then
            lresult = false.
         else 
            undo, throw e.
            
      end catch.
         
   end.
   
   return lresult.

end function.


message
   '说説' '~t' isKorean( '说説' ) skip
   '한국어 ' '~t' isKorean( '한국어 키보드' )
view-as alert-box.

huangapple
  • 本文由 发表于 2023年5月7日 10:44:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76191991.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定