Forum Replies Created

  • Masahiro

    Member
    November 8, 2021 at 6:55 am in reply to: What is the use of isAsciiPrintable() method in Apex?

    @shwetak717gmail-com For more pragmatic way how to use this isAsciiPrintable aside from its simple definition when to return true or when to return false, I usually use this method for judging CJK. (Chinese, Japanese, Korean) and then trim the text field and its content within the length to fit in the same field with alpha-numeric-space-only content.ie) Case.Subject
    "Print PDF and notify the customer" (length = 33) <= English
    "PDF印刷 顧客に通知" (length = 11) <= Japanese
    These 2 phrases are saying the same meaning, but the Japanese is a lot shorter than English. So I usually vary the length to cut the text characters to fit into the space based on isAsciiPrintable only or not.
    And one more thing about CJK when we describe the name with local characters (not alphabet), Last name comes first. So the name order either LastName FirstName or FirstName (MiddleName) LastName can be determined by isAsciiPrintable() if the name is written in local zh, ja, kr or alphabet.

    • This reply was modified 3 years ago by  Masahiro Y.

Popular Salesforce Blogs

Popular Salesforce Videos