第 32 章 str 函式庫:正規表示式與字串處理

str 函式庫提供了高階的字串處理函式,其中一些基於正規表示式。它的目的是支援通常使用諸如 awkperlsed 等腳本語言執行的檔案處理。

使用 str 函式庫的程式必須以下列方式連結

        ocamlc other options -I +str str.cma other files
        ocamlopt other options  -I +str str.cmxa other files

若要互動式使用 str 函式庫,請執行

        ocamlmktop -o mytop str.cma
        ./mytop

或 (如果您的平台支援 C 函式庫的動態連結),請啟動 ocaml 並輸入

# #directory "+str";;
# #load "str.cma";;