日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

由Lucnene 对于预治疗的文字,全角半角转换器(可执行)

發(fā)布時間:2025/3/21 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 由Lucnene 对于预治疗的文字,全角半角转换器(可执行) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

這是我第二次讀這本書,在自己的學習之間XML,javascript,的深入研究《JAVA 核心技術(shù)》。

在當中深入的學習了java的非常多機制。

回頭再來看搜索引擎這本書的時候。就認為比第一次好非常多了。


這個是代碼,能夠執(zhí)行,

假設(shè)想自己定義的話,那就把str1= " ";

中間的字符串改動。


JAVA代碼:


package com;


import java.util.HashMap;


import org.xml.sax.HandlerBase;


public class Replace {
public static String replace(String line){

//創(chuàng)建一個HashMap存儲全角和半角字符之間的相應(yīng)關(guān)系
HashMap map = new HashMap();
map.put("。", ",");
map.put("。", ".");
? ? ? ?map.put("〈", "<");
? ? ? ?map.put("〉", ">");
? ? ? ?map.put("|", "|");
? ? ? ?map.put("《", "<");
? ? ? ?map.put("》", ">");
? ? ? ?map.put("[", "[");
? ? ? ?map.put("]", "]");
? ? ? ?map.put("?", "?");
? ? ? ?map.put(""", "\"");
? ? ? ?map.put(":", ":");
? ? ? ?map.put("﹑", ",");
? ? ? ?map.put("(", "(");
? ? ? ?map.put(")", ")");
? ? ? ?map.put("【", "[");
? ? ? ?map.put("】", "]");
? ? ? ?map.put("-", "-");
? ? ? ?map.put(" ̄", "~");
? ? ? ?map.put("!", "!");
? ? ? ?map.put("`", "`");
? ? ? ?map.put("1", "1");
? ? ? ?map.put("2", "2");
? ? ? ?map.put("3", "3");
? ? ? ?map.put("4", "4");
? ? ? ?map.put("5", "5");
? ? ? ?map.put("6", "6");
? ? ? ?map.put("7", "7");
? ? ? ?map.put("8", "8");
? ? ? ?map.put("9", "9");
? ? ? ?
? ? ? ?int length = line.length();
? ? ? ?for(int i = 0; i < length; i++){
? ? ? ? String charat = line.substring(i, i + 1);
? ? ? ? if(map.get(charat) != null){
? ? ? ? line = line.replace(charat, (String)map.get(charat));
? ? ? ? }
? ? ? ?}
? ? ? ?return line;

}
public static void main(String[] args) {
// TODO Auto-generated method stub
Replace a = new Replace();
String str1 = "1111";
String str2;
str2 = replace(str1);
System.out.println("轉(zhuǎn)換后是: " + str2);


}

}



版權(quán)聲明:本文博客原創(chuàng)文章,博客,未經(jīng)同意,不得轉(zhuǎn)載。

轉(zhuǎn)載于:https://www.cnblogs.com/mfrbuaa/p/4743221.html

總結(jié)

以上是生活随笔為你收集整理的由Lucnene 对于预治疗的文字,全角半角转换器(可执行)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。