infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Tcl Library
splitting field
Kevin Crist
i am trying to split a field V99999-1-1234567891. What i want is the V99999-1. but splitting on the " - " using a 0 i get V99999, using a 1 i get 1 and using a 2 i get 1234567891. How do just keep the V99999-1 part?
Thanks for any ideas.
Find more posts tagged with
Clovertech
Comments
Rob Abbott
try this, assume "field" has the data and "result" will contain the stuff you want to keep;
set result [join [lrange [split $field -] 0 1] -]
Max Drown
This might work, too.
set value ""
regexp ^(.*?-.) $value match newValue
puts $newValue
Or something along those lines depending on exactly what you want to capture.
Also, maybe something as simple as string range may give you what you need?
RobertKersemakers
Many roads... Another one that works:
set result [string range $field 0 [expr [string last "-" $a]-1]]
Kevin Crist
all work. Thanks a bunch gentleman.