社区
C#
帖子详情
有几个函数的用法?/在线等待......有分送的
XXSingle
2003-04-23 12:14:01
怎样从一串字符串全部转成大写?
怎样截取字符串中的空格(左,中,右)?
...全文
33
5
打赏
收藏
有几个函数的用法?/在线等待......有分送的
怎样从一串字符串全部转成大写? 怎样截取字符串中的空格(左,中,右)?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
CinnXu
2003-04-23
打赏
举报
回复
System.string.Trim() 是去除空格
System.string.ToUpper()转换大写
wordinchina
2003-04-23
打赏
举报
回复
分别实现截取字符串中的空格(左,中,右)
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace stringcom
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Button button4;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(80, 32);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 0;
this.textBox1.Text = "textBox1";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 23);
this.label1.TabIndex = 1;
this.label1.Text = "input";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 23);
this.label2.TabIndex = 2;
this.label2.Text = "upper";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(80, 80);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 3;
this.textBox2.Text = "textBox2";
//
// button1
//
this.button1.Location = new System.Drawing.Point(192, 80);
this.button1.Name = "button1";
this.button1.TabIndex = 4;
this.button1.Text = "do";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 120);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 23);
this.label3.TabIndex = 5;
this.label3.Text = "left";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(80, 120);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 6;
this.textBox3.Text = "textBox3";
//
// button2
//
this.button2.Location = new System.Drawing.Point(192, 120);
this.button2.Name = "button2";
this.button2.TabIndex = 7;
this.button2.Text = "do";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 160);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 23);
this.label4.TabIndex = 8;
this.label4.Text = "mid";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(80, 160);
this.textBox4.Name = "textBox4";
this.textBox4.TabIndex = 9;
this.textBox4.Text = "textBox4";
//
// button3
//
this.button3.Location = new System.Drawing.Point(192, 160);
this.button3.Name = "button3";
this.button3.TabIndex = 10;
this.button3.Text = "do";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label5
//
this.label5.Location = new System.Drawing.Point(8, 200);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 23);
this.label5.TabIndex = 11;
this.label5.Text = "right";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(80, 200);
this.textBox5.Name = "textBox5";
this.textBox5.TabIndex = 12;
this.textBox5.Text = "textBox5";
//
// button4
//
this.button4.Location = new System.Drawing.Point(192, 200);
this.button4.Name = "button4";
this.button4.TabIndex = 13;
this.button4.Text = "do";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button4,
this.textBox5,
this.label5,
this.button3,
this.textBox4,
this.label4,
this.button2,
this.textBox3,
this.label3,
this.button1,
this.textBox2,
this.label2,
this.label1,
this.textBox1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
string tempstr=textBox1.Text;
textBox2.Text=tempstr.ToUpper();
}
private void button2_Click(object sender, System.EventArgs e)
{
string tempstr=textBox1.Text;
textBox3.Text=tempstr.TrimStart(' ');
}
private void button4_Click(object sender, System.EventArgs e)
{
string tempstr=textBox1.Text;
textBox5.Text=tempstr.TrimEnd(' ');
}
private void button3_Click(object sender, System.EventArgs e)
{
string tempstr=textBox1.Text;
string strtmp=null;
for(int i=0;i<tempstr.Length;i++)
{
if(tempstr[i]!=' ')
{
strtmp=strtmp+tempstr[i];
// MessageBox.Show("ok");
}
}
textBox4.Text=strtmp;
}
}
}
eyesluo
2003-04-23
打赏
举报
回复
upper,trim
查msdn吧
XXSingle
2003-04-23
打赏
举报
回复
多谢--------------
Knight94
2003-04-23
打赏
举报
回复
去除空格:Trim(' ');
工作中使用到的单词(软件开发)_2022-06-01备份
目录 ■Java学习汇总 ■常用链接 ■2020/03/15 (最初整理 242个单词) 2020 6/28 整理 2020 6/29整理 2020 7/6整理 ■2020 7/23 整理 ■2020/10/07 以降整理 ■2020/11/02 以降整理 ■2020/12/04 以降整理 ■2020/12/14以降整理 ■2021/01/01以降整理 ■2021/02/22以降整理 ■匿名内部类,lambda表达式,JDK7新特性,等等java相关 ■2021/03/...
linux常见命令
-->2004年10月04日用wget下载整个网站的方法wget -r -p -np -k http://202.38.75.11/~jbhuang/blog/kingpaul @ 06:40 PM 发表于 linux | 编辑 | 留言 (0) | TrackBack (0) -->2004年09月23日Linux下配置DHCP服务
Jiangsheng的CSDN Digest (Dec 2005)
CSDN 讨论总结系列:Jiangsheng的CSDN Digest (Dec 2005)(http://blog.csdn.net/jiangsheng/archive/2005/12/24/561501.aspx) Jiangsheng的CSDN Digest (Oct 2005)(http://blog.csdn.net/jiangsheng/archive/2005/12/27/56327
linux指令大全(摘自:http://www.3wbmw.cn/archiver/?tid-4706.html)
字典2006linux指令大全名称:cat使用权限:所有使用者使用方式:cat [-AbeEnstTuv] [--help] [--version] fileName说明:把档案串连接后传到基本输出(萤幕或加 > fileName 到另一个档案)参数:-n 或 --number 由 1 开始对所有输出的行数编号-b 或 --number-nonblank 和 -n 相似,只不过对于空
工作中使用到的单词(软件开发)_2021-10-23_备份
https://blog.csdn.net/sxzlc/article/details/104872052 目录 ■常用链接 2020 6/28 整理 2020 6/29整理 2020 7/6整理 ■2020/10/07 以降整理 ■2020/11/02 以降整理 ■2020/12/04 以降整理 ■2020/12/14以降整理 ■2021/01/01以降整理 ■2021/02/22以降整理 ■匿名内部类,lambda表达式,JDK7新特性,等等java相关 ■2021/03...
C#
110,552
社区成员
642,562
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章