自己写的字符串操作类
来源:互联网 发布:ipad点读机软件 编辑:程序博客网 时间:2024/05/01 02:31
今天闲来无事,突然想写一个字符串操作类。不过时间有限,只写了一点点,以后有时间,每天都写几个函数加上。今天刚写的一点如下:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
string str = "hello world! hello everyone";
string str2 = StringHandler.RemoveSpaces(str);
Console.WriteLine(str2);
}
}
public class StringHandler
{
public static string RemoveSpaces(string str)
{
string temp = "";
for (int i = 0; i < str.Length; i++)
{
if (str[i] != ' ')
temp += str[i];
}
return temp;
}
public static string Reverse(string str)
{
string temp = "";
for (int i = str.Length - 1; i >= 0; i--)
{
temp += str[i];
}
return temp;
}
}
}
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
string str = "hello world! hello everyone";
string str2 = StringHandler.RemoveSpaces(str);
Console.WriteLine(str2);
}
}
public class StringHandler
{
public static string RemoveSpaces(string str)
{
string temp = "";
for (int i = 0; i < str.Length; i++)
{
if (str[i] != ' ')
temp += str[i];
}
return temp;
}
public static string Reverse(string str)
{
string temp = "";
for (int i = str.Length - 1; i >= 0; i--)
{
temp += str[i];
}
return temp;
}
}
}
这个类虽然简单,但都写完了,字符串的操作应该就比较熟练了:)
- 自己写的字符串操作类
- Exe8 自己写的字符串操作函数
- 自己写的操作 RMS类
- 自己写的文件操作工具类
- 自己写的一个 ini 操作类
- 自己写的单链表操作
- 自己写一个字符串类
- 自己写的针对xml操作的类
- 我自己写的一个操作数据库的类
- 自己写的分割字符串的函数
- 自己写的一个数据库操作类(C#)[原创]
- 自己写的一个JavaScript 操作XML 封装类
- 自己写的一个注册表操作类----相当实用
- androd SQLite 自己写的数据库操作类
- C# 自己重新写的FTP操作类
- 自己写的数据库pdo操作类,显摆一下
- 自己写的几个字符串函数
- 自己写的 字符串函数strcpy
- 完全用xmlhttp写的
- Ajax 之实例应用
- C#设计模式之建造者(Builder)模式示例源代码
- 从C#的Singleton设计模式实现看.NET Framework特性对开发者的重要性
- 设计模式之C#实现FactoryMethod
- 自己写的字符串操作类
- 《银行ATM系统》项目实训大纲
- 利用XML穿越防火墙
- Win2000开机后实现自动登录
- 从现在开始
- 彻底掌握IIS6.0功能及应用详解
- Installing BIRT
- 最合适的IT人才是这样被筛选出来的
- pb 和 c 数据类型对照表