|
hai
i want to splir string and i want keep two parts of that string into 2 string variables
can u plz send me the code in c#
Suresh.R
|
|
|
|
|
Hello,
Use the Split method of the string class.
This will return a string[].
Try and ask again if you need more help.
All the best,
Martin
|
|
|
|
|
hi
string[] str=string.split('');
example:
string s="xxx yyy zzzz";
if u want to split string with whitespace then write this
string[] str=s.split(' ');
i hope this works fine
|
|
|
|
|
Hello shakeela!
The reason why I didn't gave an example in my answer, was the "send me the code in c#" statement in the question.
This is mostely a sign of a "Please do my homework for me, because I don't whant to lose time by thinking myself!" question!
All the best,
Martin
|
|
|
|
|
Hi!
I want to locate main menu control according to my requirement in the middle of the windows form.But i couldnot find location property for that control. I want to ask that can i change its position or it will always be placed at the top of the form.
Thanx
|
|
|
|
|
A menu is ALWAYS on the top of a form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am writing a program that downloads a database on remote laptops, When downloading the file I noticed that my program uses about 15 MB of memory and calls Windows Explorer and WE uses about 16 MB of memory, the database file is about 60MB. I was wondering if there is something i am missing to reduce the amount of memory I am using. the laptops that will be using this app are older laptops and I want this process not to interfere with another database app that is very memory intensive. and once the download is complete it does not release the memory to a reasonable level any ideas.
Thanks
Rob
FileStream fs = null; //' To access the local file;
WebRequest req;
//StreamReader sr;
try
{
// This sets up the Request instance
req = WebRequest.Create("http://www.domian.com/file.zip");
// Use a GET since no data is being sent to the web server
req.Method = "GET";
// This causes the round-trip
WebResponse rsp = req.GetResponse();
try
{
// Open the file to stream in the content
fs = new FileStream("file.zip", FileMode.Create);
// Copy the content from the response stream to the file.
CopyData(rsp.GetResponseStream(), fs);
}
|
|
|
|
|
How exactly are you copying the data from the response stream to the file stream?
Another thing to consider is that looking at memory usage in the Task Manager (which is what I assume you are doing) can often be misleading. The allocated memory listed for a .NET-based application often includes memory which has been collected (i.e. released) as far as the application goes, but which simply hasn't been given back to the system by the runtime. However, that memory can be given back if and when the runtime believes the system needs it.
If there are specific performance (memory or CPU) requirements for your application, then I would suggest using a profiler to help determine where the bottlenecks are in your application.
-Phil
|
|
|
|
|
Hello everyone,
I have a string which I would like to remove the SPACE in the string. For example, I would like to change "I would like to remove any space." into "Iwouldliketoremoveanyspace.".
Can anyone be kind enough to tell me how I can get this done?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
mystring = mystring.Replace(" ", "");
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
string TrimmedString = YourString.Trim();
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Doesn't that only remove the spaces at the beginning and end of the string?
He who laughs last is a bit on the slow side
|
|
|
|
|
True .. sorry, you can use Christian's suggestion replacing white spaces.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: you can use Christian's suggestion replacing white spaces.
No. That only removes spaces. White space includes characters like tab and line breaks.
---
single minded; short sighted; long gone;
|
|
|
|
|
Okay "black" spaces;P.. no seriously, you can remove tabs at least doing this:
string strTabs = "a\t\t\tb";
MessageBox.Show("Before: "+str);
MessageBox.Show("After: "+str.Replace("\t",@"<tab>"));
string strNewLines = "a\n\n\nb";
MessageBox.Show("Before: "+str);
MessageBox.Show("After: "+str.Replace("\n",@"<enter>"));
-- modified at 4:01 Tuesday 3rd April, 2007
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Get("HI-bhas,-"));
}
public string Get(string str)
{
StringBuilder builder = new StringBuilder();
for (int i = 0; i < str.Length; i++)
{
if (char.IsLetterOrDigit(str[i]))
{
builder.Append(str[i]);
}
}
return builder.ToString();
}
}
Suresh.R
|
|
|
|
|
That's really awful. Why would you rewrite a method that's already in the framework ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Are you talking about Normalize()
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
No, I am talking about string.Replace.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi programmer,
Im doing a project, my question is " How to allow the file to popup when the button is click." The file is in (C:\Documents and Settings\Lohsk\My Documents\Introduction.txt). Can someone help me .The program must written in c#.
|
|
|
|
|
Process.Start will open your text file in the default program ( probably notepad ). You can use File.ReadAllText to read it and display it yourself.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
try this:-
private void button1_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = @"C:\Documents and Settings\Lohsk\My Documents\Introduction.txt";
process.StartInfo.ErrorDialog = true;
process.Start();
}
catch (Exception err)
{
MessageBox.Show(err.ToString());
}
}
|
|
|
|
|
System.Diagnostics.Process.Start("YourTextFile.txt");
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
hi
i want to run exe file(s) in buffer,How to do ..thanks(pe,injection,...)
|
|
|
|
|
What do you want to do ? You want to dictate what memory a program runs in ? Process.Start will run an exe.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|