
第五章
字串與文字處理
Someone will call
Something will fall
And smash on the oor
Without reading the text
Know what comes next
Seen it before
And it’s painful
Things must change
We must rearrange them
Or we’ll have to estrange them
All that I’m saying
The game’s not worth playing
Over and over again
Depeche Mode, “The Sun and the Rainfall”
5.0 導論
被 Mathematica 卓越數學功能所吸引來的使用者,通常會對 Mathematica 數學之外的強
大功能感到驚訝,文字與字串處理功能便是其中之一,Mathematica 豐富的字串與結構
文字處理功能絕對可與 Java、Perl 這些字串處理的常用語言媲美。
以下簡單介紹基本字串處理工具。[Page-181]
字元與其編碼
Mathematica 內部核心以
Unicode
進行編碼,但介面上(如 notebook 檔案的儲存)則以
ASCII 編碼,非 ASCII 字元則編碼為特殊格式。
例如,小寫希臘字母與其他非 ASCII 字元以
\[name]
的格式進行編碼。
ch05.indd 181 2014/4/2 上午 06:12:59