文章分类 - 字符串处理
摘要:public string Highline(String StringValue, String[] HighValues, int Len){if (StringValue == String.Empty) return String.Empty;List<int> BeforePositions = new List<int>();List<int> Af...
阅读全文
摘要:有一段时间,正则表达式学习很火热很潮流,当时在CSDN一天就能看到好几个正则表达式的帖子,那段时间借助论坛以及Wrox Press出版的《C#字符串和正则表达式参考手册》学习了一些基础的知识,同时也为我在CSDN大概赚了1000分,今天想起来,去找《C#字符串和正则表达式参考手册》时,已经不知所踪了。现在用到正则的时候也比较少,把以前的笔记等整理一下,以志不忘。(1)“@”...
阅读全文
摘要:1//------------------转大写金额函数--------------------------------------------2functionNumToChnStr(Value:Real):String;3const4ChnUnit:array[0..13]ofstring=('分','角','元','拾','佰','仟','万','拾','佰','仟','亿','拾','佰'...
阅读全文
摘要:usingSystem;usingSystem.IO;usingSystem.Text;usingSystem.Text.RegularExpressions;usingSystem.Runtime.Remoting;usingSystem.Runtime.Remoting.Proxies;usingSystem.Runtime.Remoting.Messaging;usingSystem.Ref...
阅读全文
摘要:1、判断字符串是否为连续的中文字符(不包含英文及其他任何符号和数字):Regex.IsMatch("中文","^[\u4e00-\u9fa5]+$");2、判断字符串是否为中文字符串(仅不包含英文但可以包含其他符号及数字):!Regex.IsMatch("中文",@"[a-zA-Z]");
阅读全文
摘要:1/**////<summary>2///转全角的函数(SBCcase)3///</summary>4///<paramname="input">任意字符串</param>5///<returns>全角字符串</returns>6///<remarks>7///全角空格为12288,半角空格为328///其他字符半...
阅读全文
摘要:添加 Microsoft Visual Basic.NET Runtime 引用。using System;using System.IO;using System.Text;using Microsoft.VisualBasic;namespace Rainsoft.Text{/// <summary>/// 字符串编码转换类/// </summary>public cl...
阅读全文
摘要:/// <summary> /// 汉字拼音声母计算类 /// Write by WangZhenlong at 2003/11/29 /// </summary> [code=C#] /// <summary> /// 汉字拼音声母计算类 /// Write by WangZhenlong at 2003/11/29 /// 梁文刚于2009/03/26日对原...
阅读全文
摘要:代码如下: private void MoveCurorLast(){//让文本框获取焦点this.richTextBox1.Focus();//设置光标的位置到文本尾this.richTextBox1.Select(this.richTextBox1.TextLength, 0);//滚动到控件光标处this.richTextBox1.ScrollToCaret();}
阅读全文
摘要:实现代码如下:public void disply(string strInput){richTextBox1.ForeColor = Color.Chartreuse;richTextBox1.AppendText(strInput + "\r\n");richTextBox1.Refresh();}public void disply(string strInput, Color fontCo...
阅读全文
摘要:只能输入数字:"^[0-9]*$"。 只能输入n位的数字:"^\d{n}$"。 只能输入至少n位的数字:"^\d{n,}$"。 只能输入m~n位的数字:。"^\d{m,n}$" 只能输入零和非零开头的数字:"^(0|[1-9][0-9]*)$"。 只能输入有两位小数的正实数:"^[0-9]+(.[0-9]{2})?$"。 只能输入有1~3位小数的正实数:"^[0-9]+(.[0-9]{...
阅读全文
摘要:通过API [DllImport("user32.dll")] public static extern System.Int32 CreateCaret(System.IntPtr hwnd, System.IntPtr hbm,System.Int32 cx, System.Int32 cy); [DllImport("user32.dll")] public st...
阅读全文
摘要:public int[] getRandomNum(int num,int minValue,int maxValue){ Random ra=new Random(unchecked((int)DateTime.Now.Ticks)); int[] arrNum=new int[num]; redo: int tmp=0; for (int i=0;i<=num-1;i++) { tmp=...
阅读全文
摘要:源文件:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace flash{ public partial class ...
阅读全文

浙公网安备 33010602011771号