我这样说了。
string test = "http://example.com/upload/user/80_747.jpg"
string test2 = "http://example.com/upload/user/80_4747.jpg"
这两种情况都需要“747”或“4747”。 是否有这方面的任何汽车或预产功能,或需要完全人工操作。
ASP. NET C#4.0
我这样说了。
string test = "http://example.com/upload/user/80_747.jpg"
string test2 = "http://example.com/upload/user/80_4747.jpg"
这两种情况都需要“747”或“4747”。 是否有这方面的任何汽车或预产功能,或需要完全人工操作。
ASP. NET C#4.0
你可以把体力与特性分开,然后把最后一批成果阵列同起来。 2. 特性和结果组合的第一层。
缩略语
test.split( _ )[1].split( . )[0];
in CS use SubString and IndexOf methods of String class.
定期表达应当为此付出代价。 缩略语:@”_(d+)>。
Regex.Match ("http://example.com/upload/user/80_747.jpg", @"_(d+).")
.Groups[1]
.Captures[0]
.Value
int startIndex = test.LastIndexOf( _ );
int endIndex = test.LastIndexOf( . );
return test.Substring(startIndex, endIndex - startIndex);
既然你重新使用蚊帐4,如果你目前所描述的扼制格式,你就可以这样做:
return new string(test.SkipWhile(x=>x!= _ ).Skip(1).TakeWhile(x=>x!= . ).ToArray());
You can use System.IO.Path
to get the filename without the extension. You will need to parse the fragment that you want out of that filename manually. Using the framework to do that much, over straight regex of the whole path, will be slightly less error prone if, say, there was a _ in one of the folder names.
使用<代码>测试.LastIndexOf(__),以发现最后发生性质。
string val = Path.GetFileNameWithoutExtension(test.Substring(test.LastIndexOf( _ ) + 1));
test
.ToCharArray()
.Reverse()
.SkipWhile(c =>
{
int i;
return !int.TryParse(c.ToString(), out i);
})
.TakeWhile(c => c != _ );
我认为这不利于你的要求。
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!