社区
C#
帖子详情
有几个函数的用法?/在线等待......有分送的
XXSingle
2003-04-23 12:14:01
怎样从一串字符串全部转成大写?
怎样截取字符串中的空格(左,中,右)?
...全文
68
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(' ');
找到
几个
在线
查看
函数
图像的网站
本文介绍了
几个
可以直接
在线
查看数学
函数
图像的网站,包括Desmos、fooplot和91maths,这些工具对于学习数学和直观理解
函数
特性非常有用。
告别
等待
后端接口,前端使用
在线
mock数据
本文介绍如何利用MockJS和
在线
平台EasyMock为前端开发提供模拟数据,解决前后端分离下
等待
后端接口的问题。文章详细解释了MockJS的语法特点和
在线
Mock的创建步骤。
socket有
几个
队列_带您进入内核开发的大门 | 内核中的
等待
队列
本文详细介绍了内核
等待
队列的概念,包括其作为线程管理机制的作用,以及wait_queue_head_t结构体、wait_event
函数
和wake_up
函数
的基本
用法
。通过示例程序展示了
等待
队列的工作原理,强调了
等待
队列在资源状态管理和线程同步中的重要性。
QT中connect()
函数
的
用法
本文介绍了QT中connect()
函数
的
用法
,该
函数
用于实现信号与槽的关联,只有QObject类及其派生类才能使用。文中阐述了
函数
原型、各参数含义及不同连接类型,还介绍了connect()
函数
的5种
用法
,包括Qt 4宏
用法
、Qt 5新
用法
、针对重载信号的新写法及Lambda
函数
写法。
8 事件
等待
本文围绕Windows线程
等待
与唤醒机制展开,介绍了可
等待
对象、
等待
块等概念。分析了WaitForSingleObject
函数
,指出KeWaitForSingleObject是核心。还阐述了事件、信号量、互斥体等
等待
对象,说明它们在临时唤醒、修改SignalState等方面的差异及应用场景。
C#
111,129
社区成员
642,535
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章