json转string示例_C.示例中的String.Insert()方法
json轉string示例
C#String.Insert()方法 (C# String.Insert() Method)
String.Insert() method is used to insert a string in an existence string at specified index and returns a new string.
String.Insert()方法用于在指定索引處的存在字符串中插入一個字符串,并返回一個新字符串。
Syntax:
句法:
public string String.Insert(int index, string value);The method is called with "this" string i.e. the string in which we have to insert the string.
用“ this”字符串調用該方法,即我們必須在其中插入字符串的字符串。
Parameter(s):
參數:
- index – represents the index/position of the current string where new string value to be inserted. - index –表示當前字符串的索引/位置,要在其中插入新的字符串值 。 
- value – a new string to be inserted. - value –要插入的新字符串。 
Return value:
返回值:
- string – it returns a new string containing the inserted string at given index. - string –返回一個新字符串,其中包含在給定索引處插入的字符串。 
Example:
例:
Input:string str = "IncludeHelp";string str1 = " programming ";Function callstr.Insert(7, str1);Output:Include programming HelpC#使用String.Insert()方法將字符串轉換為字符數組的示例 (C# Example to convert string to characters array using String.Insert() method)
Example 1:
范例1:
using System; class IncludeHelp {static void Main(){// declaring string variablesstring str = "IncludeHelp";// inserting space between Include and Helpstring new_string = str.Insert(7, " ");Console.WriteLine("str: " + str);Console.WriteLine("new_string: " + new_string);} }Output
輸出量
str: IncludeHelp new_string: Include HelpExample 2:
范例2:
using System; class IncludeHelp {static void Main(){// declaring string variablesstring str = "IncludeHelp";string str1 = " programming ";// inserting str1 after "Include"string new_string = str.Insert(7, str1);Console.WriteLine("str: " + str);Console.WriteLine("new_string: " + new_string);} }Output
輸出量
str: IncludeHelp new_string: Include programming Help翻譯自: https://www.includehelp.com/dot-net/string-insert-method-with-example-in-csharp.aspx
json轉string示例
總結
以上是生活随笔為你收集整理的json转string示例_C.示例中的String.Insert()方法的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: [转载] python中print()函
- 下一篇: bytevalue_Java Short
