Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
Language Detection : Determine which Languages are Present in a String
Demonstrates how to encode/decode strings in various encodings w/ any charset. <% @CodePage = 65001 %> <% Response.CodePage = 65001 %> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> <body> <% ' This ASP example demonstrates how to use CkString ' to do language detection. ' Don't forget to save this .asp file in the utf-8 encoding!!! sub detectLanguages(s) Response.Write s & "<br>" set cks = Server.CreateObject("Chilkat_9_5_0.CkString") cks.Append s ' How many us-ascii characters are in s? n = cks.NumAscii Response.Write CStr(n) & " US-ASCII chars<br>" ' How many Latin (8bit) characters are in s? ' These are typically the characters with diacritics (i.e. accent marks) n = cks.NumLatin Response.Write CStr(n) & " Latin chars<br>" ' How many Central European characters are in s? ' These are also typically the characters with diacritics (i.e. accent marks) n = cks.NumCentralEuro Response.Write CStr(n) & " Central European chars<br>" ' How many Greek characters are in s? n = cks.NumGreek Response.Write CStr(n) & " Greek chars<br>" ' How many Hebrew characters are in s? n = cks.NumHebrew Response.Write CStr(n) & " Hebrew chars<br>" ' How many Arabic characters are in s? n = cks.NumArabic Response.Write CStr(n) & " Arabic chars<br>" ' How many Japanese characters are in s? n = cks.NumJapanese Response.Write CStr(n) & " Japanese chars<br>" ' How many Korean characters are in s? n = cks.NumKorean Response.Write CStr(n) & " Korean chars<br>" ' How many Chinese characters are in s? n = cks.NumChinese Response.Write CStr(n) & " Chinese chars<br>" ' How many Thai characters are in s? n = cks.NumThai Response.Write CStr(n) & " Thai chars<br>" ' How many Cyrillic characters are in s? n = cks.NumCyrillic Response.Write CStr(n) & " Cyrillic chars<br>" Response.Write "<p>" end sub detectLanguages "ABC 私はガラスを食べられます。それは私を傷つけません。" detectLanguages "ABC Sôn bôn de magnà el véder, el me fa minga mal." detectLanguages "ABC Mogę jeść szkło i mi nie szkodzi." detectLanguages "ABC Я могу есть стекло, оно мне не вредит." detectLanguages "ABC אני יכול לאכול זכוכית וזה לא מזיק לי." detectLanguages "ABC أنا قادر على أكل الزجاج و هذا لا يؤلمني." detectLanguages "ABC ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ" detectLanguages "ABC 我能吞下玻璃而不伤身体" detectLanguages "ABC 私はガラスを食 Sôn bôn Mogę jeść szkło" %> </body> </html> |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.