![]() |
| | #1 |
| Registered User Join Date: Jul 2003
Posts: 110
| String Parse. string word = "hello world dude"; i want to make a if that checks the string word for hello then if its in it take hello out and leave the rest so if("hello" in string) strip hello from string; |
| Coder87C is offline | |
| | #2 |
| and the Hat of Clumsiness Join Date: Oct 2002
Posts: 1,101
| Code: using System;
namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string iCantDoMyHomeWork = "hello world dude";
string orAnyResearch = "";
orAnyResearch = iCantDoMyHomeWork.Replace("hello","");
Console.WriteLine("Old String: "+iCantDoMyHomeWork+"\nNew String: "+orAnyResearch);
Console.Read();
}
}
}
|
| GanglyLamb is offline | |
| | #3 |
| Registered User Join Date: Jul 2003
Posts: 110
| Lol, I wish I had a C# class. This is actually for a plugin that detects strings for macros I got string word = "hello man"; if(word.StartsWith("hello")) but not sure how to "Remove" it, and I see Remove but I dont think that does what I want... |
| Coder87C is offline | |
| | #4 |
| and the Hat of Clumsiness Join Date: Oct 2002
Posts: 1,101
| I dont know what you just said but have you tried my code, .Remove works like this Code: string test = "foobar"; test = test.Remove(0,3); //test will be "bar" Code: orAnyResearch = iCantDoMyHomeWork.Replace("hello","");
if(orAnyResearch.StartsWith(" ")){
orAnyResearch = orAnyResearch.Substring(1,orAnyResearch.Length-1);
}
Last edited by GanglyLamb; 08-16-2005 at 02:21 AM. |
| GanglyLamb is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Interpreter.c | moussa | C Programming | 4 | 05-28-2008 05:59 PM |
| Calculator + LinkedList | maro009 | C++ Programming | 20 | 05-17-2005 12:56 PM |
| Classes inheretance problem... | NANO | C++ Programming | 12 | 12-09-2002 03:23 PM |
| creating class, and linking files | JCK | C++ Programming | 12 | 12-08-2002 02:45 PM |
| Warnings, warnings, warnings? | spentdome | C Programming | 25 | 05-27-2002 06:49 PM |