面試題:一個字串包含英文和特殊字元,特殊字元不變,英文順序反過來,比如string str="[email
public class Reverse { public static void main(String[] args) { String str = "[email protected]!tk"; char[] chars = str.toCharArray(); for (int i = 0, j = chars.length - 1; i < j; j--, i++) { if (!isEnglish(String.valueOf(chars[i]))) { i++; } if (!isEnglish(String.valueOf(chars[j]))) { j--; } char tmp = chars[i]; chars[i] = chars[j]; chars[j] = tmp; } for (int x = 0; x < chars.length; x++) { System.out.print(chars[x]); } } private static boolean isEnglish(String ch){ return ch.matches("^[a-zA-Z]*"); } }
結果:
[email protected]!dw
相關推薦
面試題:一個字串包含英文和特殊字元,特殊字元不變,英文順序反過來,比如string str="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b4d0a4f5c6b">[email160
public class Reverse { public static void main(String[] args) { String str = "[email protected]!tk"; char[] chars = str.toCh
面試題:一個字串包含英文和特殊字元,特殊字元不變,英文順序反過來,比如string str="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0f692e6b784f">[email160;prot
public class Reverse { public static void main(String[] args) { String str = "[email protected]!tk"; char[] char
shell特殊變數$0,$#,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="edc9ad">[email160;protected]a>,$*,$?,$$和命令列引數
變數 含義 $0 當前指令碼的檔名 $n 傳遞給指令碼或函式的引數。n 是一個數字,表示第幾個引數。例如,第一個引數是$1,第二個引數是$2。 $# 傳遞給指令碼或函式的引數個數。 $* 傳遞給指令碼或函式的所有引數
六、Shell特殊變數:Shell $0, $#, $*, <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="694d29">[email160;protected]a>, $?, $$和命令列引
前面已經講到,變數名只能包含數字、字母和下劃線,因為某些包含其他字元的變數有特殊含義,這樣的變數被稱為特殊變數。例如,$ 表示當前Shell程序的ID,即pid,看下面的程式碼: $echo $$ 執行結果 29949 特殊變數列表 變數 含義 $0 當前指令碼
linux bash Shell特殊變數:Shell $0, $#, $*, <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8aaeca">[email160;protected]a>, $?
在linux下配置shell引數說明 前面已經講到,變數名只能包含數字、字母和下劃線,因為某些包含其他字元的變數有特殊含義,這樣的變數被稱為特殊變數。 例如,$ 表示當前Shell程序的ID,即pid,看下面的程式碼: [[email protected] /]$ ec
Springboot註解<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="260b0b666549485254494a4a4354">[email160;protected]a>和@RestCon
1.使用@Controller 註解,在對應的方法上,檢視解析器可以解析return 的jsp,html頁面,並且跳轉到相應頁面;若返回json等內容到頁面,則需要加@ResponseBody註解 [email protected]註解,相當於@[email protected
python基礎<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="775a5a37141b1604041a12031f1813">[email160;protected]a>和@staticmet
Python中3種方式定義類方法, 常規方式, @classmethod修飾方式, @staticmethod修飾方式. class A(object): def foo(self, x): print("executing foo(%s,%s)" % (self, x)
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c384aab7838c9080">[email160;protected]a>伺服器和Xcode的git管理工具簡單使用
OSChina提供的git伺服器,每一個賬號可建立1000個專案,不論公有或私有專案,程式碼託管服務永久免費。而且由於是國內的網站和伺服器,又是中文的,相對於國外的而言,訪問比較通暢,操作起來也容易上手。 本文介紹如何使用OSChina的g
在linux中,$*和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90b4d0">[email160;protected]a>有什麼區別?
看了很多的文章,依然似懂非懂。現在,終於理解了它們兩者之間的區別。 $*會把當前指令碼的所有引數作為一個引數傳遞給子指令碼。(在英文中,*字元有“所有”的意思) [email protected]會把當前指令碼的所有引數分別作為一個引數傳遞給子指令碼。(在英文中,@字元有“獨立”的
【Shell】linux bash Shell特殊變數:Shell $0, $#, $*, <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4f6b0f">[email160;protected]<
在linux下配置shell引數說明 前面已經講到,變數名只能包含數字、字母和下劃線,因為某些包含其他字元的變數有特殊含義,這樣的變數被稱為特殊變數。 例如,$ 表示當前Shell程序的ID,即pid,看下面的程式碼: $echo $$ 執行結果 29949
Centos7 中[<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7c5d8d8c3f7dbd8d4d6dbdfd8c4c3">[email160;protected]a> /] 和 [
1. [[email protected] /] 和 [[email protected] ~] 的區別 剛進入Centos時, 會顯示這個[[[email protected] ~] , 後邊讓輸入命令, 其實此時是在
在linux中,$*和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="250165">[email160;protected]a>有什麼區別?
看了很多的相關文章,似懂非懂。現在,終於真正理解了它們兩者之間的區別。 首先我們看如下一個bash命令: ./start.sh "a b" "c" "d" 請問,給start.sh指令碼傳遞了幾個引數? 大部分人都知道,總共傳遞了3個引數,其中,$1等於a b,$2等
verilog中assign和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3859544f59414b78">[email160;protected]a>(*)兩者描述組合邏輯時的差別
verilog描述組合邏輯一般常用的有兩種:assign賦值語句和[email protected](*)語句。兩者之間的差別有: 1.被assign賦值的訊號定義為wire型,被[email protected](*)結構塊下的訊號定義為reg
@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9edfebeaf1e9f7ecfbfadecfebfff2f7f8f7fbec">[email160;protected]a>和@Resour
@Autowired:是Spring自己定義的註解。@Autowired按byType自動注入。注入系統型別不會有type相同的多個類問題。當自定義了多個type相同,名稱不同的類時使用@Qualifier進行限定。@Qualifier預設限定的是name。使用@Qualifier需要在配置檔案&l
Spring 註解例項<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="82afafc2c3f7f6edf5ebf0e7e6">[email160;protected]a> 注入到List和Map
package com.Autowired.ListMap; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; /** *
AngularJs註解之<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b598989898f5dcdbc5c0c1">[email160;protected]a>和@output
從翻譯的角度看 input---輸入 output---輸出 所以:這兩個註解的意思是:對父元件傳入的引數的接收,和對結果傳入到父元件中 程式碼奉上: 父元件中的傳參 &nb
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e89e9d8dc58b8481a8dbc690">[email160;protected]a>之使用vue ui建立專案-來自一個戰五渣的體驗
1. 全域性安裝vue-cli yarn global add @vue/cli // 檢查安裝是否成功 vue -V // 3.2.2 2. 初始化 vue ui 執行命令 vue ui 2.1 該命令會自動開啟你的瀏覽器,預設地址為: localhost:8000/project/s
Git在windows下的安裝和使用<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="52151b06121d0111">[email160;protected]a>
Git for Windows v2.7.0 Release Notes Latest update: January 5th 2016 Introduction These release notes describe issues specific to the Git for Windows rele
ios筆記<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="476a6a07373528372235333e">[email160;protected]a>寫法和autorelease pool自
1、@property語法知識介紹 格式:@property(引數1,引數2) 型別 名字; 引數說明:引數可有可無,預設為atomic,表示給方法加鎖,保證執行緒安全。 引數主要分為3類: 1)讀寫屬性:readwrite/readonly :有getter和setter
spring <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ea8885859eaabc8b869f8f">[email160;protected]a>和bean執行順序問題
從配置檔案中獲取配置使用@value,當你在bean載入時呼叫@value時會出現空指標異常。因為bean載入完成後才會執行@value。 解決辦法:spring boot 有兩種獲取配置檔案值的方式 第一種,@value(“${a.b}”)傳屬性名稱 第二種:使