共用方式為


SqlFunctions.Stuff 方法

定義

將字串插入另一個字串中。 這樣會從開始位置,刪除目標字串中指定長度的字元,然後再於開始位置處,將第二個字串插入目標字串中。

[System.Data.Entity.DbFunction("SqlServer", "STUFF")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="start")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="stringInput")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="stringReplacement")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId="string")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="length")]
public static string Stuff(string stringInput, Nullable<int> start, Nullable<int> length, string stringReplacement);
static member Stuff : string * Nullable<int> * Nullable<int> * string -> string
Public Shared Function Stuff (stringInput As String, start As Nullable(Of Integer), length As Nullable(Of Integer), stringReplacement As String) As String

參數

stringInput
String

目標字串。

start
Nullable<Int32>

stringinput 中要插入取代字串的字元位置。

length
Nullable<Int32>

要從 stringInput 中刪除的字元數。 如果 length 超過 stringInput ,則刪除作業最多會發生到 stringReplacement 中的最後一個字元。

stringReplacement
String

要插入 stringInput 中的子字串。

傳回

由這兩個字串組成的字串。

屬性

適用於