-
February 23rd, 2015, 02:08 PM
#1
I need to get what is between the "-" and the "x" 12.450X5.65-13.476x12.89
12.450X5.65-13.476x12.89
I need the 13.476 out of the above string
the data look like this
23.5625X11.375-11.125x19.5625
5.625X17.25-2.875x14.5
23.75X17.25-12.5x19
-
February 23rd, 2015, 03:47 PM
#2
Re: I need to get what is between the "-" and the "x" 12.450X5.65-13.476x12.89
This is what I have I just can't get it to come out right
<code>
If instr(Trim({Flat_panel1.jmaPartShortDescription}), "-") <> 0 THEN
If instr(Trim({Flat_panel1.jmaPartShortDescription}), "x") <> 0 Then
startPos1 = instr(Trim({Flat_panel1.jmaPartShortDescription}), "x") - 1
Stileandrail = right(Trim({Flat_panel1.jmaPartShortDescription}),startPos1)
Else
Stileandrail = Trim({Flat_panel1.jmaPartShortDescription})
End IF
xposition = instr(Stileandrail, "x")
startpos2 = len(Stileandrail) - xposition
formula = Right(Stileandrail,startpos2)
</code>
-
February 24th, 2015, 06:09 AM
#3
Re: I need to get what is between the "-" and the "x" 12.450X5.65-13.476x12.89
I'm not a crystal expert, but why not use mid() to extract the required info. Something along these lines (not tested and not complete)
Code:
str1 = instr({Flat_panel1.jmaPartShortDescription}, "-")
str2 = instr({Flat_panel1.jmaPartShortDescription}, "x")
if str1<> 0 then
if str2 <> 0 then
number = trim(mid({Flat_panel1.jmaPartShortDescription}, str1 + 1, str2 - str1 - 1))
else
number = trim(mid({Flat_panel1.jmaPartShortDescription}, str1 + 1))
....
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|