瀏覽單個文章
Tirpitz
Master Member
 
Tirpitz的大頭照
 

加入日期: Apr 2001
您的住址: Coruscant
文章: 1,637
對呀。如果不是功課或是靠這吃飯的,誰會浪費外面好幾個晴朗的天空...

不說說是功課的感覺很怪齁,好像想坐享其成,上來丟問題,等收網。

我可先說,老師一開始只教了這個:
import javax.swing.*;

public class reversewholestring{

public static void main(String args[]) {
String input;
StringBuffer output;
char letter;

input = JOptionPane.showInputDialog(null, "Enter a sentence:");
output = new StringBuffer(input);

output = output.reverse();

System.out.println(output);
System.exit(0);
}

}
這是反轉整個字串的。
例如:Hi! I am Tirpitz. ---> .ztipriT ma I !iH

然後就要求這個。
本來還寫了一個又臭又長的程式,大概快100行了。一大堆迴圈抓單字。
後來翻書翻翻∼發現有這個Token的工具可以用。
又爬文爬很久找到怎麼清StringBuffer。這些他都沒有教過...課本上也輕描淡寫的。

所以啊,我現在遇到瓶頸了。只是想說這裡臥虎藏龍的,
有沒有高手可以點破一下關鍵點,或是提示一下其他有用的工具。
指點迷津...

ps.我有縮排啦∼只是貼上來就都不見了...沒辦法。
__________________
Un Jedi ne doit connaitre ni la colere, ni la haine, ni l'amour.
Someday I will be the most powerful Jedi ever~!!

Jedi Code
there is no emotion;there is the peace
there is no ignorance;there is the knowledge
there is no passion;there is the serenity
there is no death;there is the Force
舊 2004-05-14, 11:07 PM #6
回應時引用此文章
Tirpitz離線中