473,503 Members | 4,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String Split into Recurring Fields that can be either active/inactive

57 New Member
Okay, as I said in my last question about setting up a variable Field-Name to gain initial focus, I'm building a database that will split/manipulate a shorthand code/text and put it in various fields depending on their state. This is a poker database and if you know anything about poker, often times, seats are empty or people fold their hands which will 'inactivate' their future actions. I have fields that will catalog each seat's actions through the hand, that I'm seeking to populate using long strings of the shorthand-code/text I've become familiar with.

An example of the hand set-up is this: B0505E04080910.

Big Blind is Seat 5 and he put up 05$. Seats 04, 08, 09, 10 are empty and as part of that initial string manipulation, I've dis-enabled all the related Seats 04, 08, 09, 10 fields. I've gotten that to work with the assistance of a poster yesterday.

Now, I'm into the revolving string manipulation portion with FieldNames of PoD_Seat01, PoD_Seat02...PoDSeat10 that I wish to populate with data pulled from this string. "06FC05FFR07FC05"

In literal terms, it means: Seat 06 Folded, Seat 7 Called 05$, Seat 8-10 Empty and aren't represented, Seat 1 Folded, Seat 2 Folded, Seat 3 Raised $07, Seat 4 Empty and not represented, Seat 5 Folded, Seat 6 - Folded and no longer in the hand, Seat 7 Called $05.

Graphically
S-01: F
S-02: F
S-03: R07
S-04: Empty
S-05: F
S-06: F
S-07: C05 - C05
S-08: Empty
S-09: Empty
S-10: Empty

Is there a way to assign these actions in a revolving door where based on the codes and field-enabled states, that you can auto-populate the fields involved; taking into account some fields will be dis-enabled (empty) and others will become dis-enabled (folded).

I'm thinking 10 variables that will be each temporary holding spot for each seat's actions...where you'll skip over if the actual field is dis-enabled or if the last character in the variable is an "F" (fold) but I'm not sure this is the way to go, or even how to reset the targeted variable when you cycle back to it from Seat 10 to Seat 1.

I know it's confusing and I'm probably losing half the audience.
Apr 22 '11 #1
5 1984
Rabbit
12,516 Recognized Expert Moderator MVP
You would have to create a VBA procedure to parse the string.

The real question is why are you representing the data in this manner instead of splitting it out initially?
Apr 22 '11 #2
HSXWillH
57 New Member
The reason I don't do it upfront is I don't have the computer at the table with me. My shorthand code enables me to keep notes quickly and effectively; which I then input in their native form and my goal is to have the VBA parse it into the appropriate fields.

The only part of the coding I don't know have a real idea on how to proceed at this point is the looping within the group of fields and how to account for fields that are either inactive upfront or become inactive based on their input.

The string manipulation itself isn't the issue.
Apr 22 '11 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Well, since you already know which seat to start with, you just have to start parsing from there and skipping the seats that are empty. What are you having trouble with exactly? The steps are fairly straightforward.
  1. Get starting seat
  2. Get action
  3. Assign to first non-empty seat
  4. Repeat from step 2 until end of string
Apr 22 '11 #4
HSXWillH
57 New Member
I guess I'm having the trouble of Step 3 here. I might be confusing string manipulation with parsing...how to assign that action to the appropriate seat and then cycle through; knowing that Seat 6 for instance can have 2 actions in the same turn; just separated by all the other actions in the middle.

Expand|Select|Wrap|Line Numbers
  1. Dim Counter As Integer
  2. Dim MyString As String
  3. Dim CurrentChar As String
  4. Dim CurrentAction As String
  5. Dim FirstAction As String
  6.  
  7. FirstAction = Mid(Me.Post_Deal_Code, 2, 2)
  8. MyString = Right(Me.Post_Deal_Code, Len(Me.Post_Deal_Code) - 3)
  9.  
  10. For Counter = 1 To Len(MyString)    'do something to each character in string
  11.     CurrentChar = Mid(MyString, Counter, 1)
  12.     If IsNumeric(CurrentChar) Then
  13.         CurrentAction = CurrentAction & CurrentChar
  14.     Else
  15.         If (CurrentAction <> "") Then
  16.             MsgBox CurrentAction  'mere placeholder for this action spot -- this will be the action area to assign to a seat/variable.
  17.         End If
  18.         CurrentAction = ""
  19.         CurrentAction = CurrentAction & CurrentChar
  20.     End If
  21. Next
In this situation; the string is S06FC05FFR07FC05E so we'd start with S06 under the FirstAction variable and then each Action is broken into F-C05-F-F-R07-F-C05 and the E is the end of the string. With S04/8/9/10 already out, I'm lost on how to assign to the appropriate sections.

I can get the data value, but I can't place it at all with any clear idea on how.
Apr 22 '11 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Well, what you need is something like this, which is in pseducode
Expand|Select|Wrap|Line Numbers
  1. i = 1
  2. intSeat = get starting seat number
  3.  
  4. Do While i < length of string
  5.    strAction = ' Get action
  6.  
  7.    Do Until seats(((intseat - 1) Mod totalnumberofseats) + 1) <> empty
  8.       intSeat = intSeat + 1
  9.    Loop
  10.  
  11.    seats(intSeat) = strAction
  12.  
  13.    i = i + Len(strAction)
  14. Loop
Apr 22 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2215
by: MetalOne | last post by:
string.split("") ==> string.split("",",") ==> I did not expect these to have different outputs. I have a string with comma delimited numbers. There can be zero or more numbers in the string...
11
2483
by: Carlos Ribeiro | last post by:
Hi all, While writing a small program to help other poster at c.l.py, I found a small inconsistency between the handling of keyword parameters of string.split() and the split() method of...
4
2545
by: Henry Chen | last post by:
Hi, I have a string that needs to be parsed into the string. The separator is not char. It is something like " at ". With current string.Split function, it doesn't work. Is there any exist...
6
6357
by: Senthil | last post by:
Code ---------------------- string Line = "\"A\",\"B\",\"C\",\"D\""; string Line2 = Line.Replace("\",\"","\"\",\"\""); string CSVColumns = Line2.Split("\",\"".ToCharArray());
19
10892
by: David Logan | last post by:
We need an additional function in the String class. We need the ability to suppress empty fields, so that we can more effectively parse. Right now, multiple whitespace characters create multiple...
5
5851
by: kurt sune | last post by:
The code: Dim aLine As String = "cat" & vbNewLine & "dog" & vbNewLine & "fox" & vbNewLine Dim csvColumns1 As String() = aLine.Split(vbNewLine, vbCr, vbLf) Dim csvColumns2 As String() =...
3
2615
by: David Pratt | last post by:
Hi. I am splitting a string on a non whitespace character. One or more whitespace characters can be returned as items in the list. I do not want the items in the list that are only whitespace (can...
4
6022
by: Michele Petrazzo | last post by:
Hello ng, I don't understand why split (string split) doesn't work with the same method if I can't pass values or if I pass a whitespace value: >>> "".split() >>> "".split(" ") But into...
8
8225
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
2
4750
by: Transcend2030 | last post by:
Hi, I'm having problems with string.split() My problem is; I have a sentence which the user inputs, I then input a word and the number of times that word appears in the sentence is displayed. ...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.