久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 ColdFusion 中規范化字符串

Normalize String in ColdFusion(在 ColdFusion 中規范化字符串)
本文介紹了在 ColdFusion 中規范化字符串的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試在 ColdFusion 中規范化字符串.

I'm trying to normalize a string in ColdFusion.

我想為此使用Java類java.text.Normalizer,因為據我所知CF沒有任何類似的功能.

I want to use the Java class java.text.Normalizer for this, as CF doesn't have any similar functions as far as I know.

這是我當前的代碼:

<cfset normalizer = createObject( "java", "java.text.Normalizer" ) />
<cfset string = "?é?è" />
<cfset string = normalizer.normalize(string, createObject( "java", "java.text.Normalizer$Form" ).NFD) />
<cfset string = ReReplace(string, "\p{InCombiningDiacriticalMarks}+", "") />
<cfoutput>#string#</cfoutput>

任何想法為什么它總是輸出 ?é?è 而不是規范化字符串?

Any ideas why it always outputs ?é?è and not a normalized string?

推薦答案

在 ColdFusion 中,與 Java 不同,您不需要在字符串文字中轉義反斜杠.您當前的正則表達式不會匹配不以反斜杠開頭的任何內容,因此不會發生替換.

In ColdFusion, unlike in Java, you don't need to escape backslashes in string literals. Your current regex will not match anything that does not start with a backslash, so no replacement happens.

除此之外,您的代碼完全正確,您可以看到輸出時字符串的長度是 8,而不是 4.這是 normalize 調用的效果.

Other than that, your code is perfectly correct and you can see that the length of the string is 8, not 4, at the time of the output. This is an effect of the normalize call.

但是,請記住,它仍然是原始字符串的等效表示,因此您無法從視覺上區分差異也就不足為奇了.這是正確的 Unicode 渲染.

However, remember that it is still an equivalent representation of the original string, and so it is not surprising that you cannot tell the difference visually. This is correct Unicode rendering in action.

這篇關于在 ColdFusion 中規范化字符串的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 午夜天堂 | 国产激情在线 | 久久精品一区 | av在线电影网站 | 久久激情五月丁香伊人 | 午夜精品久久久久久久久久久久久 | 日本一区精品 | 国产一区二区在线免费 | 国产在线观看一区 | 国产精品久久av | 免费人成激情视频在线观看冫 | 看片国产 | com.国产| 精产嫩模国品一二三区 | 午夜精品久久久久久久星辰影院 | 精品免费视频 | 精品国产色 | 日韩中文在线视频 | 成人h动漫精品一区二区器材 | 一色桃子av一区二区 | 久久久tv | 欧美在线一二三 | 国产精品无码久久久久 | 亚洲啊v在线 | 精品国产欧美日韩不卡在线观看 | www精品美女久久久tv | 亚洲综合区 | 国产一级免费视频 | 男人天堂色 | 国产精品免费看 | 久久精品视频一区二区 | 一区二区三区免费在线观看 | 日韩在线免费观看视频 | 91国产精品 | 91一区二区三区 | 日本成年免费网站 | 在线看av网址 | 日本精品一区二区在线观看 | 国产精品乱码一区二区三区 | 99热首页 | 亚洲精品99 |