• Welcome to Valhalla Legends Archive.
 

[C#] Problem...

Started by Smarter, March 24, 2007, 03:27 PM

Previous topic - Next topic

Smarter


Public Function GetString(S As String) As String: GetString = Mid(S, InStr(1, S, Chr(34)) + 1, Len(S) - (InStr(1, S, Chr(34)) + 1)): End Function


This code takes the string contained inside quotes("), and then returns it without them, this is used for things like:
|INFO "Blah has banned blah2 (blah)"

Where, if you had split the string by space, it wouldn't give you the quoted text, however I'm not sure how to reproduce this function in C#, I thought of doing a like replace, but then I'd have to use a switch, and parse it for the first two splits, and ugh, i'm just confused.
Since '99

BrutalNet.Net

l)ragon

    Public Function GetString(ByVal S As String) As String
        Return S.Substring(S.IndexOf(""""), S.IndexOf("""", S.IndexOf("""") + 1))
    End Function


I'm a bit tired atm but this should help you figure out substring abit.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*