Learning English From Android Source Code:2 Ampersand

來源:互聯網
上載者:User

標籤:迴圈   ken   tin   class   any   index   elements   ring   翻譯   

這一次想把標點符號的英語表達總結一下,這些單詞非常重要但easy被我們忽視。以我的經驗,還是多認識幾個。以備不時之需。

以下從“標點符號”開始:

punctuation

[英][?p??kt?u?e??n][美][?p??kt?u?e??n]

n.標點法; 標點符號; 標點符號的使用; 點標點; 

ampersand
[英][??mp?s?nd][美][??mp?rs?nd]
n."&"的記號名稱,and符; 

原始碼中使用:

出自frameworks/base/core/java/android/net/UrlQuerySanitizer.java

609     /**610      * Parse a query. A query string is any number of parameter-value clauses611      * separated by any non-zero number of ampersands. A parameter-value clause612      * is a parameter followed by an equal sign, followed by a value. If the613      * equal sign is missing, the value is assumed to be the empty string.614      * @param query the query to parse.615      */616     public void parseQuery(String query) {617         clear();618         // Split by ‘&‘619         StringTokenizer tokenizer = new StringTokenizer(query, "&");620         while(tokenizer.hasMoreElements()) {//解析工作被放在while迴圈中,與xml的解析相似621             String attributeValuePair = tokenizer.nextToken();622             if (attributeValuePair.length() > 0) {623                 int assignmentIndex = attributeValuePair.indexOf(‘=‘);624                 if (assignmentIndex < 0) {625                     // No assignment found, treat as if empty value626                     parseEntry(attributeValuePair, "");627                 }628                 else {629                     parseEntry(attributeValuePair.substring(0, assignmentIndex),630                             attributeValuePair.substring(assignmentIndex + 1));631                 }632             }633         }634     }
先說說clauses這個詞和檔案名稱UrlQuerySanitizer,然後再嘗試翻譯parseQuery方法的凝視。

clause

[英][kl?:z][美][kl?z]
n.從句,分句; 條款,款項; 【計】子句
凝視中是對字串的解析,那麼這裡譯成從句或子句更好一些。

一個條款的例句:What clause do you require in the contract(合約)?

Sanitizer

這個詞比較有趣。由於直接翻看詞典的解釋為消毒殺菌劑,清掃車。跟本文貌似不太搭噶。

我再看sanitize的翻譯。vt.使清潔。 進行消毒; 審查; 淨化。也有對其審查之意。

結合上下文,這個類的作用是對URL請求檢查或清理,那麼這裡譯成審查者我覺得還不錯。哪位有更好的建議歡迎賜教。

凝視的翻譯例如以下:

解析一個請求。這個請求字串被隨意的非零的‘&’符分成隨意數位參數值子句(And符就是拆分標識)。

一個參數值子句是一個參數後面跟一個等號。然後再跟一個值。假設等號沒有了,後面的值就會被覺得是空。

Learning English From Android Source Code:2 Ampersand

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.