Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
zifuc2.cs
Package: Visual.rar [view]
Upload User: yiyuerguo
Upload Date: 2014-09-27
Package Size: 3781k
Code Size: 1k
Category:
CSharp
Development Platform:
Others
- using System;
- using System.Collections;
- public class MyClass
- {
- public static void Main()
- {
- string s = " asdf fasdf fasdf ";
- Console.WriteLine("before:");
- Console.WriteLine(s);
- Space( ref s );
- Console.WriteLine("after:");
- Console.Write(s);
- Console.ReadLine();
- }
- private static void Space( ref string str )
- {
- //空格在字符串中所处在的位置
- int index = str.IndexOf(' ');
- if( index >= 0 && index <= str.Length-1 )
- {
- try
- {
- //分成前后两个部分进行字符串的缩减
- string start = str.Substring( 0, index ).Trim();
- string end = str.Substring( index+1, (str.Length-index-1 )).Trim();
- //递归处理前后两端
- Space( ref start );
- Space( ref end );
- //把递归后的前后两端累加起来
- str = start + end;
- }
- catch( Exception e )
- {
- Console.Write(e.Message);
- //RL();
- }
- }
- }
- }