最简单的五种弦乐方法 [英] easiest five methods of string

查看:100
本文介绍了最简单的五种弦乐方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

字符串在c#中起着非常重要的作用
我只想知道c#中的5种字符串方法
最简单的一个
在此先感谢
:)

string places very important role in c#
i just want to know 5 methods of string in c#
the easiest one
thanks in advance
: )

推荐答案

Replace
Substring
EndsWith
StartsWith
Trim


我们不做您的作业:这是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.
自己尝试,您可能会发现它并不像您想的那么困难!


We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!


奇怪的问题,但是以下是我认为最简单或最重要的五种方法:
Strange question´, but here are the five methods that I think are the easiest or most important ones:
string test = "Hello World";
string[] parts = test.Split(' ');   //splits the string into pieces
bool bIsEmpty = String.IsNullOrWhiteSpace(test);   //checks if the string is empty
int nWhiteSpace = test.IndexOf(' ');   //finds index of first whitespace in string
test = test.Replace(" ", ""); //removes any white space in string
test = test.ToUpper();  //transforms the string to uppercase


在这里不能这样工作.

这是询问者的期望:
1. 先尝试您要做什么!您可能会发现它并不难.
2.制定看起来像问题/无法解决的问题.

试试看,告诉他们是否遇到问题.
成员将很乐意为您提供帮助.



现在,您可能已经完成MSDN并看到:字符串方法 [ ^ ]
-Concat
-比较
-EndsWith
-格式
-StartsWith
-Subtring
-ToUpper
-ToLower
It does not work like this here.

Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it''s not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.



For now, you could have done MSDN and seen: String Methods[^]
- Concat
- Compare
- EndsWith
- Format
- StartsWith
- Subtring
- ToUpper
- ToLower


这篇关于最简单的五种弦乐方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆