Hi, thanks for reading. Any help is greatly appreciated.
I need help with parsing data in an input field.
If I have the following in my varchar 255 input filed
part1-part2-part3-part4-part5
I want to put part1 and part2 in one field and all other parts in another field. The dash between part2 and part3 is not needed because it's a delimiter, but I need to keep the dash between all other parts because it's part of the data. Any ideas on how to do this?
Below is what I'm trying to do
Newfield 1
part1-part2
Newfield 2
part3-part4-part5
Substring/parse question
Moderators: chulett, rschirm, roy
Use Field() and tell it the field is "-" delimited. For the first part, take 2 fields starting from field 1, for the second take 3 fields starting with field 3. The optional argument after the field number to extract controls how many fields to extract. It defaults to 1 if you don't specify it.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
NewField1 <-- Field(OldField, "-", 1, 2)
NewField2 <-- Field(OldField, "-", 3, 3)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.