请教哪位哥哥能帮我看看,我想将字符串数组里的"\"前加个转义字符"\"放到新的字符串数组里!但是遇到了一些问题在线等作答!妹子不能感激~~~

lady000 lady000 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package t;
/**
*
* @author Administrator
*/
public class T {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String str;
str="d:\\数\\b\\c";
int m=str.length();
int n;
String strF[]=new String[m];
for(int i=0;i<str.length();i++)
{
strF[i]=str.substring(i, i+1);
}

for(int k=0;k<m;k++)
{

if(strF[k].equalsIgnoreCase("\\"))
{
n=m;
m+=1;


for(int j=n;j>k;j--)
{

strF[j]=strF[j-1];

}
k+=1;
}

}
for(int i=0;i<strF.length;i++){
System.out.print(strF[i]);
}
}
}
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
lady000
非技术区 23,404 成员 70,505 内容