日期:2014-05-18  浏览次数:20420 次

刚结100分,再来100分, 还是字符串截取问题,大家进来讨论下,UP也给分~~
最近搞了个辅助工具,上一任程序走了,所以我接到这个弄的很不爽,呵呵~~加上本人比较菜(看正则跟乱码差不多那种),所以麻烦大家了~
不多说了,下面说问题:
1.ageStart   =   "1981年05月19日 ";
      问题描述:取出的出生日期就是上面这样子,我需要datatime类型   如1981-05-19
2.str   =   "软件工程师,高级软件工程师,GAY... "   //目标职能
      问题描述:每个职位都是用 ", "分开的最后一个没有,分别取出来
3.edu   =   "1998/09--2001/07玉林师院计算机科学与技术   本科    
软件工程   数据结构   系统结构   网络安全等   "           //教育经历
      问题描述:   这个上周弄过,前面时间,学校,专业能弄出来,但是专业和学历之间有空格,还有就是要下面的专业课名称
我对分不是很在乎,都给你们也行,呵呵,大家多费心了,上周帮忙的兄弟在这里谢谢了,祝大家中秋快乐~~


------解决方案--------------------
sf
------解决方案--------------------
jf
------解决方案--------------------
1.String.Format就可以解决
日期 {0:D} 2006年11月25日
日期 {0:d} 2006-11-25

2.String[] querySplit = new String[x];
Char[] charSeparators = new Char[] { ', ' };

querySplit = strQuery.Split(charSeparators, StringSplitOptions.None);

3.没看明白
------解决方案--------------------
up
学习
------解决方案--------------------
1.String.format
2.string.replace
3.string.Split

具体怎么做看自己的要求,给你点例子:
1.string.format
// This code example demonstrates the String.Format() method.
// Formatting for this example uses the "en-US " culture.

using System;
class Sample
{
enum Color {Yellow = 1, Blue, Green};
static DateTime thisDate = DateTime.Now;

public static void Main()
{
// Store the output of the String.Format method in a string.
string s = " ";

Console.Clear();

// Format a negative integer or floating-point number in various ways.
Console.WriteLine( "Standard Numeric Format Specifiers ");
s = String.Format(
"(C) Currency: . . . . . . . . {0:C}\n " +
"(D) Decimal:. . . . . . . . . {0:D}\n " +
"(E) Scientific: . . . . . . . {1:E}\n " +
"(F) Fixed point:. . . . . . . {1:F}\n " +
"(G) General:. . . . . . . . . {0:G}\n " +
" (default):. . . . . . . . {0} (default = 'G ')\n " +
"(N) Number: . . . . . . . . . {0:N}\n " +
"(P) Percent:. . . . . . . . . {1:P}\n " +
"(R) Round-trip: . . . . . . . {1:R}\n " +
"(X) Hexadecimal:. . . . . . . {0:X}\n ",
-123, -123.45f);
Console.WriteLine(s);

// Format the current date in various ways.
Console.WriteLine( "Standard DateTime Format Specifiers ");
s = String.Format(
"(d) Short date: . . . . . . . {0:d}\n " +
"(D) Long date:. . . . . . . . {0:D}\n " +
"(t) Short time: . . . . . . . {0:t}\n " +
"(T) Long time:. . . . . . . . {0:T}\n " +
"(f) Full date/short time: . . {0:f}\n " +
"(F) Full date/long time:. . . {0:F}\n " +
"(g) General date/short time:. {0:g}\n " +
"(G) General date/long time: . {0:G}\n " +
" (default):. . . . . . . . {0} (default = 'G ')\n " +
"(M) Month:. . . . . . . . . . {0:M}\n " +