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 call
str.Insert(7, str1);
Output:
Include programming Help
C#使用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 variables
string str = "IncludeHelp";
// inserting space between Include and Help
string new_string = str.Insert(7, " ");
Console.WriteLine("str: " + str);
Console.WriteLine("new_string: " + new_string);
}
}
Output
输出量
str: IncludeHelp
new_string: Include Help
Example 2:
范例2:
using System;
class IncludeHelp
{static void Main()
{// declaring string variables
string 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()方法相关推荐
- String和C#中的string有什么区别?
示例( 注意情况 ): string s = "Hello world!"; String s = "Hello world!"; 每种使用的准则是什么? 有什 ...
- c#中的long类型示例_C#中带示例的带符号字节数组
c#中的long类型示例 C#中的有符号字节数组 (Signed Byte Array in C#) In C#.Net, we can create a signed byte array by u ...
- c#中的long类型示例_C#中带示例的无符号字节数组
c#中的long类型示例 C#中的无符号字节数组 (Unsigned Byte Array in C#) In C#.Net, we can create an unsigned byte array ...
- c 语言string类用法,C++中的string类用法简介
本文主要介绍C++中的string类的常见用法. 1. 概述 string是C++标准库的一个重要的部分,主要用于字符串处理.可以使用输入输出流方式直接进行string操作,也可以通过文件等手段进行s ...
- JAVA中string的赋值_Java中关于String赋值的两种形式
说明: String在java中是使用频率很高的一个类,之前使用的时候并没有过多的在意,只知道有两种赋值方式,一种是采用字面值方式(String string1 = "string" ...
- c++ string类_C++|细说STL string类概貌及底层细节
C语言中的字符串称为C风格字符串,是一个以'0'结尾的字符数组,string.h库只提供了有限.不甚安全的字符串操作函数.char str[]只能定义编译期确定大小的字符串,而保存在堆内存的动态字符数 ...
- json转string示例_C.示例中的String.Copy()方法
json转string示例 C#String.Copy()方法 (C# String.Copy() Method) String.Copy() method is used to copy a str ...
- stack示例_C.示例中的Stack.CopyTo()方法
stack示例 C#Stack.CopyTo()方法 (C# Stack.CopyTo() method) Stack.CopyTo() method is used to copy the stac ...
- c语言 函数的参数传递示例_C语言中带有示例的remove()函数
c语言 函数的参数传递示例 C语言中的remove()函数 (remove() function in C) The remove() function is defined in the <s ...
最新文章
- Openstack组件实现原理 — Keystone认证功能
- AI一分钟 | AI单挑医学专家;中国AI企业破4000家
- Homework_4 四则运算 - C#版
- oracle11g 启动报错 缺少系统参数
- PolyBase 指南
- 关于JQUERY动态加载页面时的JS失效的问题
- HDOJ2013_蟠桃记
- mysql桦仔_Microsoft SQL Server 2005技术内幕:T-SQL查询笔记
- 厉害,Spring Boot 2.3.0 刚刚发布了!
- excel如何把顺序倒过来_excel怎么把顺序倒过来
- DaSiamRPN、SiamRPN++论文阅读
- Mac删除OBS的虚拟摄像头
- fedora30解决Rhythmbox MP3中文歌曲歌名乱码
- Java学习成长路径
- 配置阿里云镜像源失败
- 人工神经网络——理解人工神经元和神经网络
- 十三、Jmeter生成html报告
- C/C++图书信息管理系统水电管理信息系统
- 基于SpringBoot的口腔保养管理系统
- 联想拯救者Y70(L71091)9008线刷救砖教程