|
Hi everyone,
I use Regex for splitting a string. Now i have 2 Questions:
1. I have e.g the string "something || anything && anotherthing" and I want to split it into string[3] ={ something, anything, anotherthing }; is there an easier way than to use 2 Regex like Regex("||") and Regex("&&") and split it first with one Regex and then each element with the other?
2. I have heard that when you split a string you can leave the splitsequence (like in the example before "||") to one of the stringsresults. How can I do that?
Thanks for your help!
|
|
|
|
|
If you have the same delimiter between strings, then the easiest way is to use Split() method of string class.
string str = "aaa::bbb::ccc";
string[] splittedStrings = str.Split("::");
But, if the explression is more difficult, then Regex is a good solution
|
|
|
|
|
Why not just use the following regex: "( \|\| )|( && )" It finds either and can be used in your split.
Hogan
|
|
|
|
|
Somehow that is not working...
I tried
Regex reg = new Regex("(\\|\\|)(&&)");
on
string input = "something || anything && anotherthing";
but it isnt Spliting it even once
|
|
|
|
|
Try again with the correct string
Regex reg = new Regex("( \|\| )|( && )");
Hogan
|
|
|
|
|
Oh there was an | between the brackets...
Thanks a lot, and this also solves Question 2
|
|
|
|
|
Hello,
I have a little Stored Procedure (SQL Server 2005), which returns some tables. Now, I'm getting those tables in the DataSet in my code. The problem is that I'm not getting TableName of none of the tables. All I get is a default naming convention "Table", Table1", Table2" ....
What is the way to get the TableName from SP? How can I basically know which table represents which select in the SP?
Thanks,
Maxim
|
|
|
|
|
|
What do you mean: "you can't"? There has to be some proper way to get tables named then counting them in the SP and then reading them like myDataSet.Tables[5]. And what if SP has been changed? Will I have to recompile the whole project? BTW, If I can't then why do I need this property "TableName" at all?
modified on Tuesday, March 3, 2009 1:55 AM
|
|
|
|
|
Maxim Langman wrote: There has to be some proper way to get tables named
There isn't. There can't be.
Maxim Langman wrote: then why do I need this property "TableName" at all
You don't.
|
|
|
|
|
Hi evryone
I have some C# question
1. how to make event and use him ?
2. how to transfer file from computer1 to computer2 (in LAN - in share folder)
I try whit File.Copy, but it isent work
thank's for any help
|
|
|
|
|
1. There are many great articles around on CodeProject and elsewhere. A search here and on google should yeild many results. I also have an article here[^] aimed at beginners to events.
2. .NET applications without some work cannot access network shares etc with good reason. You can do it using impersonation (and spplying valid credentials of a user that has permissions to access the share) or physically altering the .NET runtime security policy on each machine that requires it.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
1. In order to create an event in your call you should do declare two things:
a. Declare public delegate
b. Declare public event which is an instance of this delegate
public delegate void ClickHandler(int Param1, int Param2);
public event ClickHandler Click;
Then when you want to fire this event you just call it:
private void foo(){
...
...
Click(argument1, argument2);
...
}
2. File.Copy should work if you map the drive
|
|
|
|
|
|
It's not so useful in VB.NET, but it's used when accessing the bitmap contents in memory using pointers. It's good for C# and managed C++, but VB.NET has no use for it since there is no pointer support in VB.NET.
If you want an example, there is a good series of Image Processing articles by Christian Graus that shows how to use it. Just search the articles for "Image Processing for Dummies".
|
|
|
|
|
Great, thank you very much
|
|
|
|
|
I hate to be a contrarian, but that's not correct. Bob Powell has some really great documentation on GDI+. Just google Bob Powell GDI+. When there, search for LockBits.
Bitmaps are usually displayed on screen. If you're editing a portion of a bitmap that is displayed, it will be really slow because it has to perform safe edits on each pixel. Instead, you can grab the piece (even if that piece is the whole image) you want to work with and copy that piece into an array of memory and pin it there. That's what LockBits does for you. Calling SetPixel on the copied, pinned array will be much, much faster, but you have to remember to call UnlockBits so that it can be unpinned.
Without darkness, there are no dreams.
-Karla Kuban
|
|
|
|
|
Hi,
I am looking for a way to programatically read a Word document and based on the formatting, extract text. Specifically, I am searching each line in a document for a particular heading; then, extracting text if the following lines are bulleted. I would appreciate it if anyone would point me in the right direction.
Thanks in advance,
Ed
|
|
|
|
|
Windows has many services running. How can I call a method from a particular service from my application.
Suppose Service name "ftpsvc" is running. From my aplication I want to call a method of ftpsvc service
to see the return value.
I have some idea about Remoting, WCF. Any example code or pointing to the right direction will be helpful.
thank you.
|
|
|
|
|
I think you may be confusing a Windows service with a web service.
- A Windows service is an app that can be configured to start when the Windows starts and runs in the background as long as Windows is running. IOW, a user isn't required to be logged on in order to run the app.
- A web service is an API that can be accessed over the network. A WCF web service is hosted in a service host, which is usually IIS, a Windows service, or a Windows or console app.
/ravi
|
|
|
|
|
Hi
Thank you for your reply.
My question is not about the type of services.
I have a windows service running and suppose it has a Method (contract) called GetTime(). From another service or application,how can I call GetMethod() of the other running windows service.
Thank you
|
|
|
|
|
s196675m wrote: I have a windows service running and suppose it has a Method (contract) called GetTime().
Just to confirm I understand you, your Windows service has a ServiceHost that hosts the WCF service that has the GetTime() operation contract, right?
If so, just add a reference to the WCF service (make sure it's running) in your client app. You can do this through the IDE or generate the reference (i.e. the client proxy) manually using svcutil.exe . Then, just call the proxy's GetTime() method.
/ravi
|
|
|
|
|
I want to use usb to parallel port in my C# applications
I Have one but I don't know its address.
abdallah
|
|
|
|
|
Does anyone know how to get the primary key value when inserting a record into a FoxPro table? Thanks.
|
|
|
|
|
I think you should search here[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|