VS 2010 Parsing Concatenated String?
Jun 25, 2011
I am writing a tool that logs stats for a first person shooter game. The game writes its information (including who killed who with which weapon) to a log file, which I read every so many seconds and parse so that I can write that information to a database.I am now having trouble parsing the weapon out of that string of information.
Some additional information is required: a weapon in this game can contain attachments (such as a scope, a grenade launcher, etc). Weapons can have either 1 or 2 attachments. Some weapons however cannot have any attachments at all.
Each log file entry that describes a kill contains a code that describes the weapon that was used. This code is a concatenation of either 3 or 4 parts:
<weapon>_<attachment>_mp
<weapon>_<attachment1>_<attachment2>_mp
where <weapon> is a code that describes a weapon and <attachment> is another code describing the attachment.This should be easy to parse by just splitting along the underscore characters, but there's a few catches:
1. Some attachments are able to kill players as well. Specifically: grenade launchers, flame throwers and underbarrel shotguns. In this case, the attachment is listed before the weapon:
<attachment>_<weapon>_mp Note also that in this case there is always only 1 attachment.
2. The biggest catch: some weapon names have an underscore in them (some even have 3 underscores)! So simply splitting along the underscore won't work in all cases; if the weapon name contains an underscore I'm splitting the name of the weapon..This makes the list of possible combinations a lot longer. The ones I can think of (I think these are all):
[Code]...
View 10 Replies
ADVERTISEMENT
Jan 17, 2011
I have a concatenated string like...
str= 1010,5050,6079
And want to separate the string In Javascript I can do
string = Srt.split(","):
and the result...
string[2]=5050
Is there a way to do this in VB.NET?
View 2 Replies
Mar 9, 2011
I need to parse a string that consists of fields in quotes, separated by commas. Using Split would work fine, but sometimes one of the fields has a comma in it. ie. "My Company, Inc","USA","12.50","125000"I'm just looking to get the fields into elements in an array. Can someone suggest a way to handle the embedded commas that are sometimes present?
View 4 Replies
Aug 15, 2011
I'm suppose to end up with a label box with my name spelled out in it using string manipulation. This is suppose to happen using the concatenated string to output the name into the label box. I don't have any error codes but I also don't have my name in the label either. [code] "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. [code]
View 2 Replies
Feb 21, 2011
For my application, there is a login form in which users have the option for it to "save the login information" Kind of like MSN or other websites in which you go to a login page an the information is filled out. On my login form, I am using this code for my checkbox which is to "save login info"
Private Sub CheckBox1_CheckChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.Click
Dim s As New System.Text.StringBuilder
[Code]....
View 4 Replies
Jul 13, 2010
I am trying to programatically create textboxes in my app. I need to do this:
dim textbox(x) as new textbox
x needs to loop 1 thru 10 but I can't get VB to accept my coding.
View 2 Replies
Mar 5, 2009
I would like to be able to parse vb.net code files, so I can examine the collection of Subs, Functions (and their contents, including comments), private variables, etc. I can be open the actual source code files. So for example, if I have:
[Code]....
View 7 Replies
Jan 31, 2012
I have a dictionary that I want to access with a key that is the combination of a string (AcctNum) and a date (BalDate).It seems to me the simplest approach is to create the key by simply converting the date to a string and concatenating:MyKey = BalDate.ToString & "|" & AcctNum
I know I also have the option of creating a composite key by writing a separate class and overriding GetHashCode() and Equals() a la this solution. To me, the concatenated string is a simpler, if somewhat less elegant, solution. Am I missing some compelling reason why I should go with the composite key class approach?
This lookup is the crux of the project I am working on, so performance is my main objective (with readability a close second).
View 2 Replies
Dec 8, 2009
I'm creating a text box with auto-suggested. So, it works well. It suggests only first name, but I want it to suggest the full name (first and last name which two different columns). Take a look at the following code behind that worked as expected :
[Code]....
View 1 Replies
Apr 27, 2012
I figure I should use 'Aggregate' but apparently I am getting it wrong First I get a list of my Entity objects Dim employers As List(Of myEntity) = (New XXXX()).getZZZ(userName, userType) Then I figured this would be a way to put all the names in a string Dim names as String = employers.Aggregate(Function(current, [next]) current.Name & " " & [next].Name)
[Code]....
View 2 Replies
Mar 16, 2011
I'm creating a vb.net winforms application that will take in user given strings, parse them, and print out labels with variable information. The given string will be used in all the labels, but the variable part of the string will change with each label.
My question is: is it better to parse the strings one time, then store those values in arrays, or to parse the string each time a label is printed? Which will perform better? Which is better practice? What is the proper way to test something like this?
View 2 Replies
Apr 2, 2011
I need to sort the values of my listbox to have the latest date on top plus some text. here is the code I'm using:
[Code]...
View 4 Replies
Apr 30, 2009
What is the simplest way to return the second part of an email address? eg: yx = somefunction(y); how do I get x to retur
View 6 Replies
Jan 13, 2009
Have been struggling with parsing XML as there seems so many options. My XML string is formatted as follows
<mysite>
<request>
<type>login</apiType
[code]......
View 24 Replies
Jun 28, 2010
im doing a simple calculatro and was happy with the way i done things .. a ew member variables and a properties:
Private MVAR_Number1 As Decimal
Private MVAR_Number2 As Decimal
Private MVAR_Operator As Char[code].....
he want to add this:
Dim Operators() As Char = ("+", "-", "*", "/")
Dim OpPos as Decimal
OpPos = Expr.IndexOfAny(Operators)[code].....
Just drives me mad how complex this is all getting for something so simple, fell like giving it all up .
View 6 Replies
Jul 13, 2010
I have a very long string. I need to parse this string so I can get information out of it. I know what each segment starts with and ends with. The length of the information will vary. I don't know what the easiest way of parsing this string.
Example data will be
ST*997*232898~AK1*HC*8888*~NM1*2*TESTING........
So i will want to get everything from ST to AK1then AK1 to NM1 and so on and so on.
View 10 Replies
May 28, 2009
I have a string array (strValues()) that holds a large quantity of character data. I need to parse out characters that follow "*PN" and end with "*". I then need to store this data in a datatable so that I can loop through it afterwards and pull out the unique records to be added to an existing dataset. I've been trying to use basic "IndexOf" to get started but it tells me "Overload resolution failed because no accessible 'IndexOf' accepts this number of arguments". Is there a way to accomplish what I'm trying to do?Sample data: MS50*CF3224205*PNineed/thisdata*SD07JAN10*ED21JAN10
View 4 Replies
Apr 19, 2011
I have a string(text) which has some sigle line and multiline comments.
single line comments are shown by "--" and multiline by "/* */".
View 2 Replies
Aug 18, 2009
I have a string of type 2009-08-18 12:00 AM to parse into a datetime object. How do I do so?
View 2 Replies
Nov 15, 2009
After countless hours of searching I have been unable to get this code to work. If anyone can provide we with an alternative. I know the easiest way is to use the Split() function but im trying to do an alternative method by identifying the spaces within the string and splitting them up.
I tried the search function, but to no avail.
Attached is the code.
CODE:
View 5 Replies
Oct 19, 2011
I'm trying to find a way to parse a string which looks like this:
1,394,7,0,0,0,0,0,,0,0,63,85,0,,0,0/2,595,59,8,0,0,0,0,0,,,0,0,,0,8,6,0/3,696,0,0,0,0,,,0,0,,84,0,0/#
So that it only reads the first two digits, then delete everything after that till it reads a "/", read the first two digits and delete everything up to the "/" again.This would result in this:
1,394
2,595
3,696
I don't know how to remove every character after the last of the first two digits up to the first / it reads, can anyone help me with that?How can I parse this code easily?
View 3 Replies
Feb 8, 2012
I have unstructured string. From this I need to find the date.
Example: [expected inputs]
"01/21/2012: text will be here"
";01/21/2012: text will be here"
[code].....
View 4 Replies
Aug 5, 2011
I have files that are one long line of text but are made up of individual segments. I have managed to parse the segments into a string array but now need to parse each segment into its individual fields, based upon a field structure defined by the first 2 characters of the segment.For example:
CA12345ABC999999XXPPPPPPPP55
CA segment (CA is first 2 characters of segment) has fields defined as:
Field Name,Start,Length
[code]....
View 5 Replies
Apr 6, 2012
I've written a little library to include in other projects that does some string parsing. One of the items I'd like to access as a property of the class is a string array.I can't seem to get the syntax right though. Even though the little project will build - when I add the .dll to my other project and create a reference to it, it gives me an error - argument not specified for parameter
[Code]...
As a matter of fact, I thought in VS 2010, you didn't have to use the get, sets anymore, but I can't seem to find the right example for what I'm trying to do.
View 16 Replies
May 20, 2010
I am having a string in CSV format.http:[code].....I can add new values to it by some mechanism. Everything will be same except the new values will have numeric part = 0. Take example I have this exsiting CSV string
1 , abc.txt , 2 , def.doc , 3 , flyaway.txt
Now by some mechanism i added two more files Superman.txt and Spiderman.txt to the existing string. Now it became
1 , abc.txt , 2 , def.doc , 3 , flyaway.txt, 0, Superman.txt, 0 , Spiderman.txt
What i am doing here is that this csv string is paased into SP where its splitted and inserted to db. So for inserting I have to take the files with numeric part 0 only rest will be omiited .Which will be further then converted into CSV string.Array will look like this
str[0]="1"
str[1]="abc.txt"
str[2]="2"[code].....
So at last i want to say my input will be
1 , abc.txt , 2 , def.doc , 3 , flyaway.txt, 0, Superman.txt, 0 , Spiderman.txt
Desired Output:
0, Superman.txt, 0 , Spiderman.txt
View 1 Replies
May 19, 2010
I have splitted comma separated values in an string array, something like this
[Code]...
note 0,2,4,6,8 [even positions] are having number and odd positions are having string. I am having a class Attachmodel
[Code]...
In the above i want to set the values and bind it to the grid, using List
View 1 Replies
Jul 14, 2010
I need to convert a string such as "01h45m" into a TimeSpan. I know I can split the string apart to get the numbers, just looking for something more elegant...
View 2 Replies
Jul 27, 2011
I am reading from an IO.port and returning the data to a string. I need to parse this to data rows that each represent a data record which I will add to a datagridview.
The data basically looks like this. I have inserted <SOH>,<US>, etc. for readability.
[Code]...
View 17 Replies
Apr 2, 2011
I'm able to retrieve the source code of a web page and store it in a string variable. I would like to cast that string variable into an HTMLDocument if possible, to make parsing its elements much easier.
View 5 Replies
Jul 16, 2009
I've built a string using the Format method:
Format("[{0}{1} {3}:{4}]", var1.ToString, var2.ToString, var3.ToString, var4.ToString)
var1 to var4 are long type. Is there a way to easily extract the information back (other then the String.Split method) ?
Like: MagicMethod("[{0}{1} {3}:{4}]", formatedString, var1, var2, var3, var4)?
View 2 Replies