Mothra Posted January 22, 2004 Posted January 22, 2004 Hey all, I'm still learning c# and have a question about getting certain characters out of a string. I'm looking for the two characters that follow a delimiter. I want to take a string like this: "~A ~B ~C3 ~D" and put the characters after into an array: myArray[0] = "A " myArray[1] = "B " myArray[2] = "C3" ... The size of the array will be different every time so I need something similar to VB's ReDim Preserve as well. I can do this in VB 6.0 and .NET just fine. Anyone have any ideas on how to get it into C#? Quote Being smarter than you look is always better than looking smarter than you are.
Administrators PlausiblyDamp Posted January 22, 2004 Administrators Posted January 22, 2004 string s = "~A ~B ~C3 ~D"; string[] result; result = s.Split('~'); short and sweet ;) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Mothra Posted January 22, 2004 Author Posted January 22, 2004 I thought I had tried that before and it wasn't working but, now, it seems to work just fine. Thanks a lot! Quote Being smarter than you look is always better than looking smarter than you are.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.