|
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 )
|
|
|
|
|
System.Diagnostics.Process.Start("YourApplicationFile.exe");
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
How to know a EXE file was written by .net language or not?
|
|
|
|
|
In what context ? You can run reflector on it and see if you can see the source code. You can examine the header, if you want to do it within a program.
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 )
|
|
|
|
|
|
Then you need to find out exactly how the file itself marks that it is .NET, and write code to read the head of the file and examine it for this info.
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 think i know the way you said before,but,i do not know the code.
|
|
|
|
|
Good question, I've been having the same question.. for java, it's easily Identified by it's ugly purple controls "if not using UIs" but .Net
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
just wait for the answer.
|
|
|
|
|
I cant remember where exactly, but thers PE00 somewhere in the header.
---
The sum of the intelligence of the world is constant. The total number of people is always increasing.
|
|
|
|
|
You could use .NET Reflector[^] to point it at the .EXE and see if it will disassemble.
|
|
|
|