共用方式為


Array.sub<'T> 函式 (F#)

建置新陣列,這個陣列包含由起始索引和長度所指定的指定子範圍。

命名空間/模組路徑: Microsoft.FSharp.Collections.Array

組件:FSharp.Core (在 FSharp.Core.dll 中)

// Signature:
Array.sub : 'T [] -> int -> int -> 'T []

// Usage:
Array.sub array startIndex count

參數

  • array
    Type: 'T []

    輸入陣列。

  • startIndex
    型別:int

    子陣列的第一個項目的索引。

  • count
    型別:int

    子陣列的長度。

傳回值

建立的子陣列。

備註

這個函式是名為 GetSubArray中 已編譯的組件。 如果從一個語言,F # 以外,或透過反映存取 [函式],使用這個名稱。

範例

下列範例會顯示使用 Array.sub以指定 子陣列。 輸出會顯示在子陣列 5 之以零起始的索引處開始,並有 10 個元素。

let a1 = [| 0 .. 99 |]
let a2 = Array.sub a1 5 10
printfn "%A" a2
  

平台

Windows 7、Windows Vista SP2、Windows XP SP3、Windows XP x64 SP2、Windows Server 2008 R2、Windows Server 2008 SP2、Windows Server 2003 SP2

版本資訊

F# 執行階段

支援版本:2.0、4.0

Silverlight

支援版本:3

請參閱

參考

Collections.Array 模組 (F#)

Microsoft.FSharp.Collections 命名空間 (F#)