Hi, i got the string
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;
Hi, i got the string
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;
How to replace the following white space after Hello is something you should be able to figure out yourself.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(); } } }
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...
I dont know what you just said but have you tried my code, .Remove works like this
So I dont know if you tried my code but it works except for the following space character which you can delete by doing thisCode: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.