面試題:一個字串包含英文和特殊字元,特殊字元不變,英文順序反過來,比如string str="[email prot
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="0f692e6b784f">[email160;prot
public class Reverse { public static void main(String[] args) { String str = "[email protected]!tk"; char[] char
面試題:一個字串包含英文和特殊字元,特殊字元不變,英文順序反過來,比如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
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 當前指令碼
本機su登入root使用者輸入的密碼和ssh <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d5f4242596d1c141f031c1b15031c03141b">[email160;prot
允許root登入 vi /etc/ssh/sshd_config 將PermitRootLogin值改yes 允許不輸入密碼登入 將PermitEmptyPasswords yes前面的#號去掉 重啟服務:service sshd restart(/etc/in
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
mysql Access denied for user <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="25574a4a5165494a4644494d4a5651">[email160;prot
今天做一個遊戲,伺服器呼叫mysql,查詢使用者名稱密碼,結果怎麼也登入不上mysql,在網上找到一個網友的解決方法,按照他的方式一步一步解決了。 問題重現(以下討論範圍僅限Windows環境): C:\Users\Administrator> mysql
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)
mysql Access denied for user <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="93e1fcfce7d3fffcf0f2fffbfce0e7">[email160;prot
好久沒有使用mysql,突然想起來開啟一個以前的mysql資料庫的專案看看,結果開啟頁面時出錯,提示為:mysql Access denied for user [email protected]錯誤 百度了一下,網上說要改my.ini,於是我到mysql的安裝目錄C:\Program Files
Unable to resolve dependency for ':<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="56372626163233342331">[email160;prot
今天匯入Android專案的時候突然遇到了一個問題,‘Unable to resolve dependency’ 有點頭疼,然後就在網上找了很多方法,發現都不行,最後發現,原來是 這個檔案的配置出了錯,我新匯入的gradle-4.6-all.zip,我的專案的是gradle-4.4
<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