爱问知识人 爱问教育 医院库

编写JAVA程序

首页

编写JAVA程序


        

提交回答
好评回答
  • 2008-12-02 08:50:00
      import  。*;public class FormatString {     public static void main(String[] args)  throws IOException    {     InputStreamReader stdin = new InputStreamReader( );     BufferedReader reader = new BufferedReader(stdin);    intln("enter 'quit' to quit the program!");    intln("enter a string:");     String line =  adLine();   while (!"quit"。
      equals( im())) { intln("your entered:"); intln(deleteSChar(line)); System。 intln("enter a string:"); line = adLine(); } } static String deleteSChar(String source) { if (source。
      length() <= 0) return source; return placeAll("[s]+", ""); }}。

    a***

    2008-12-02 08:50:00

其他答案

    2008-12-02 10:46:00
  • 这个很简单,不要用循环,那还不如用C++了。你String类 里有API函数replace原型如下 String replace(char oldChar, char newChar) 返回一个新的字符串,它是通过用 newChar 替换此字符串中出现的所有oldChar 而生成的。输入一个字符串后你可以用下的处理一下就可以了(假定你的字符串是strName)strName= place("s","");strName= place("S",""); 分别是用空串代替"s","S"

    1***

    2008-12-02 10:46:00

  • 2008-12-01 21:49:00
  • public class Reverse { public static void main(String[] args) {   intln("请输入一个字符串:");  String buf = new java.util.Scanner( ).nextLine();   intln("你输入的字符串是:"+buf);   intln("删除s后输出:"+ placeAll("s","")); }}

    f***

    2008-12-01 21:49:00

类似问题

换一换
  • 互联网 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新资料 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):