Parse the string into two double
Hello everyone, once again
I'm taking a string of numbers that can be anywhere from - 999999.999999 to + 999999.99999 and separate them into two double rooms. For example, if a user entry - 10000, 10000 - two doubles would be-10000 and-10000. If the user has entered - 10.11111- + 20.00111 he got out - 10.11111 and 20.00111. The VI "Extract the numbers" did perfectly, but I need a way to return the results in two double rooms instead of an array of doubles. I also results to return all the digits after the decimal point for reasons of precision. I use this code within one of my States in a state machine and the driver I use only accepts double rooms.
The code of "Extract the numbers" VI is attached. Thank you all!
Hi buickgn,
When your code works, you should only use IndexArray on outputs. If not, try this one:
Tags: NI Software
Similar Questions
-
Need help to split the string into two fields
Can someone share your thoughts by dividing the prod_info string below into two fields
For example:-TABLE of PROD
SOURCE TABLE
SNO PROD_INFO 1 20 OZ SIMILAC 2 HW PRO 10 3 REX 10 OZ 4 AAA 10 5 BBB 2000 6 CCC 10 LB 7 DDD 2021 8 EE 12 KG 9 KK 11111 10 ZZ ABC FAC 11 11 RKW DD CC 12 OZ 12 12KJ 12 LBS. EXPECTED RESULTS
SNO PROD_INFO PROD_VAL 1 SIMILAC 20 OZ 2 HW PDR 10 3 REX 10 OZ 4 AAA 10 5 BBB 2000 6 CCC 10 LB 7 DDD 2021 8 EA 12 KG 9 KK 11111 10 AEC ABC ZZ 11 11 RKW DD CC 12 OZ 12 12KJ 12 LBS. with
as Prod
(select 1 sno, "SIMILAC 20 OZ" prod_info of all the double union)
Select 2, 'HW PDR 10' from dual union all
Select 3, 'REX 10 OZ' from dual union all
Select option 4, "AAA 10' from dual union all
Select 5, "BBB 2000"of the dual union all
Select 6, 'CCC 10 LBS' double union all
Select 7, 'DDD 2021' from dual union all
Select 8, 'EE 12 KG' from dual union all
Select 9, 'KK 11111' Union double all the
choose 10, "ZZ ABC FAC 11' from dual union all
Select 11, 'CC DD RKW 12 OZ' from dual union all
Order 12, '12KJ LB 12' double
)
Select sno,
(prod_info regexp_substr(prod_info,'^((\d*|\w*)[^[:digit:]].*) \d',1,1,null,1).
regexp_substr (prod_info,' prod_value (\d+.*)$',1,1,null,1))
Prod
SNO PROD_INFO PROD_VALUE 1 SIMILAC 20 OZ 2 HW PDR 10 3 REX 10 OZ 4 AAA 10 5 BBB 2000 6 CCC 10 LB 7 DDD 2021 8 EA 12 KG 9 KK 11111 10 AEC ABC ZZ 11 11 RKW DD CC 12 OZ 12 12KJ 12 LBS. Concerning
Etbin
-
Splits the string into two columns
Can someone please help me the following
I want to divide into two columns URL and ID /cfd/abc.html,/night/aaa/Page1,/can/MLP/Page2|107
Result must be
Temporary table
< font color = "red" > URL < / police > < font color = 'blue' > ID < / make >
< font color = "red" > /cfd/abc.html < / police > < font color = "blue" > 107 < / make >
< font color = "red" > / night/aaa/page 1 < / police > < font color = "blue" > 107 < / make >
< font color = "red" > / can/MLP/Page2 < / police > < font color = "blue" > 107 < / make >
There can be N number of comma separated URLs, but there will be only 1 separate ID which is the vertical bar (|)Try this,
SQL> WITH T 2 AS (SELECT '/cfd/abc.html,/night/aaa/Page1,/can/MLP/Page2|107 ' str FROM DUAL UNION ALL 3 SELECT '/cfd/def.html,/bbbb/bbbb/Page1,/lll/MLP/Page3|108 ' str FROM DUAL) 4 SELECT REGEXP_SUBSTR ( str, '[^,|]+', 1, lvl) URL, 5 REGEXP_SUBSTR ( str, '[^|]+', 1, 2) ID 6 FROM T, 7 (SELECT LEVEL lvl 8 FROM (SELECT MAX (LENGTH (REGEXP_REPLACE ( str, '[^,]'))) mx FROM T) 9 CONNECT BY LEVEL <= mx + 1) 10 WHERE Lvl - 1 <= LENGTH (REGEXP_REPLACE ( str, '[^,]+')) 11 order by id,lvl; URL ID -------------------------------------------------- ------------------------------------------------- /cfd/abc.html 107 /night/aaa/Page1 107 /can/MLP/Page2 107 /cfd/def.html 108 /bbbb/bbbb/Page1 108 /lll/MLP/Page3 108 6 rows selected. SQL>
G.
-
Splits the string into two columns to dashboard
Hi all
I got thisworking
decode (SUBSTR (ADDR2_ATTR_1, 1, INSTR(ADDR2_ATTR_1,'-')-1), '9999', NULL, (SUBSTR (ADDR2_ATTR_1, 1, INSTR(ADDR2_ATTR_1,'-')-1))),
decode (SUBSTR (ADDR2_ATTR_1, INSTR (ADDR2_ATTR_1,'-') + 1), '9999', NULL, (SUBSTR (ADDR2_ATTR_1, INSTR(ADDR2_ATTR_1,'-') + 1)))
but the results were a little different.
It came as
Col1 for 8-10 have come beauiful... .but however Col2 data should be in K1 and transferred to Col2
Col1 Col2
< null > 10
< null > 33
8 10
Any guidance is appreciated.Personally, I like the cases, but another way using the DECODE method...
WITH t AS (SELECT '8-10' str FROM DUAL UNION ALL SELECT '163' FROM DUAL UNION ALL SELECT '789' FROM DUAL) SELECT str col1, DECODE (NVL2 (NULLIF (INSTR (str, '-'), 0), 99999, 0),99999, SUBSTR (str, 1, INSTR (str, '-', 1) - 1),str) col2, DECODE (NVL2 (NULLIF (INSTR (str, '-'), 0), 99999, 0),99999, SUBSTR (str, INSTR (str, '-', 1) + 1),NULL) col3 FROM t;
Simplified:
------WITH t AS (SELECT '8-10' str FROM DUAL UNION ALL SELECT '163' FROM DUAL UNION ALL SELECT '789' FROM DUAL) SELECT str col1, DECODE (SIGN (INSTR (str, '-')),1, SUBSTR (str, 1, INSTR (str, '-', 1) - 1),str) col2, DECODE (SIGN (INSTR (str, '-')),1, SUBSTR (str, INSTR (str, '-', 1) + 1), NULL) col3 FROM t;
OUTPUT:
COL1 COL2 COL3 8-10 8 10 163 163 789 789
See you soon,.
Manik.Published by: adding a simplified version
-
Oracle regular expressions - splits the string into words for
Hello
Nice day!
My requirement is to split the string into words.
So I need to identify the new line character and the semicolon (;), comma and space like terminator for string entry.
Please note that I am currently embedded blank and the comma as separator, as shown below.
Select regexp_substr('test)
TO
string in words, "([^, [: blanc:]] +) (', 1, 1) double;"How to integrate the semicolons and line break characters in regular expression Oracle?
Please notify.
Thanks and greetings
Sree
This has nothing to do with REGEXP. Is SQL * more parser does not not a semicolon at the end of the line:
SQL > select ' testto, mm\;
ERROR:
ORA-01756: city not properly finished chainSQL >
Just break the chain:
SQL > select regexp_substr ('testto, mm\;' |) '
2 string into words
3 \w+',1,level ',') of double
4. connect by level<= regexp_count('testto,mm\;'="" ||="">=>
5 string in words
6 ','\w+')
7.REGEXP_SUBSTR ('TESTTO, MM\;' |') STRINGIN
--------------------------------------
Testto
mm
string
in
WordsSQL >
Or modify SQL * more the character of endpoints:
SQL > set sqlterm.
SQL > select regexp_substr ('testto, mm\;)
2 string into words
3 \w+',1,level ',') of double
4. connect by level<=>=>
5 string in words
6 ','\w+')
7.REGEXP_SUBSTR ('TESTTO, MM\;) STRINGINTOWO
--------------------------------------
Testto
mm
string
in
WordsSQL >
SY.
-
splits the string into 3 parts
Hello
I have a requirement to split the string into 3 different room example inf.ethz.ch should be subdivided into inf ethz ch in 3 different column
We have table called email within this column contains all identification of email we need to divide email with dot (.) in different columns and display please suggest how to implement in the query
Thank you
Sudhir
Use REGEXP_SUBSTR:
SQL > with t as (select ' inf.ethz.ch' double txt)
2 Select regexp_substr (txt,'[^.] +') part_1,.
3 regexp_substr (txt,'[^.] +', 1, 2) part_2,.
4 regexp_substr (txt,'[^.] +' 1, 3) part_3
5 t
6.BY PARTY PA
--- ---- --
INF ethz chSQL >
Or you can use SUBSTR + Instr.
SY.
-
How to parse this string into an array
Someone sees an easy way to parse this string into an array of type
[Street 1, 2, city, zip code]
the string:
'
[
[address = "Paris Ltd, 5 North Street, Athens, SW1X 9the"]
[address = "Paris Ltd, 5 North Street, Athens, SW1X 9the"]
]
'
THX
If you want just the address as a single entry as myArray [1] = 'Paris Ltd, 5 North, Athens, SW1X 9A Street', then try this:
If you really want the different elements had a blast, you would need a picture of structures, so you get .street1 myArray [1] = 'Paris Ltd ':
Note: As Steve has pointed out, you may need to test for listLen() on the addressList object to determine whether or not there is a street.2 entry in any given row.
-
I haven't used regular expressions before, and I can't find a regular expression to extract a subset of the string between two markers.
The chain;
Stuff of header I want
Stuff of header I want
Stuff of header I wantStuff of header I want
Stuff of header I want
Stuff of header I want6 ERRORS
Info I want to line 1
Info I want line 2
Info I want line 3
Info I want to line 4
Info I want to line 5
Info I want line 6
END_ERRORSFrom the string above (it is read from a text file), I try to extract the subset of string between ERRORS 6 and END_ERRORS. The number of errors (6 in this case) can be any number from 1 to 32, and the number of lines I want to extract will correspond with this number. I can provide this number of a caller VI if necessary.
My current solution, which works, but is not very elegant;
(1) using Match Regular Expression for the return of the string after you have synchronized the 6 ERRORS
(2) uses the Regular Expression matches to return all characters before game END_ERRORS of the string returned by (1)
Is there a way this can be accomplished using 1 Regular Expression Match? If so someone could suggest how, as well as an explanation of the work of the given regular expression.
Thank you very much
Alan
I used a character class to catch any word or whitespace characters. This put inside parentheses a substring matching the criteria that you can get by developing the node for regular expression matching. The \d matches the numbers and the two * s repetition of the previous term. So, \d* will find the '6', as well as "123456".
-
I am Brazilian and I use Adobe Acrobat Reader DC a lot. I would suggest an implementation of features present in the PC, I missed a lot of things on Android, which is 'New window' or something like that, like split the screen into two parts in order to see the two different parts of the same file.
For smartphones, its use is restricted, but for tablets, it can be really useful, because it allows the display of two distinct points of the same file,
I have reduced considerably the use of paper using this application, however, I need to navigate the file always pick up a few points seen earlier, which causes a lot of discomfort compared to printed documents.
This is a suggestion, but I would like it to be considered.
Thank you for your request. We have taken note of the same and must try to integrate it into one of our future releases.
Thank you.
-
splits the string into documents
Hello
I did a query (see regexp) that split a string into records. The problem with the query is the separate in the subquery. Otherwise, it returns millions of records where I expect less than a thousand.
Meanwhile, I found an other solution (see xmlsequence), but this statement returns the message "ORA-03113: end of file on the communication channel.
Please advice.
regexp:
xmlsequence:SELECT smp.sample_id FROM ( SELECT sa.sample_id, sau.u_box_code, sau.u_box_position FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau WHERE sd.sdg_id = sdu.sdg_id AND sd.sdg_id = sa.sdg_id AND sa.sample_id = sau.sample_id AND sau.u_padded_out = 'F' AND sdu.u_client_type = decode('#Client#','-1',sdu.u_client_type,'#Client#') AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#') AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#') AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#') AND sd.status IN ('V','P','C') ) smp, ( SELECT distinct box_code, regexp_substr(box_pos,'[^,]+',1,level) box_pos FROM ( SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu WHERE pt.plate_template_id = p.plate_template_id AND p.plate_id = pu.plate_id AND pt.name = 'Box96' AND p.status IN ('V','P','C') AND p.description like '%NP=%' AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#') AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#') AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#') AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#') ) connect by level <= length(box_pos) - length(replace(box_pos,',')) + 1 ) box WHERE smp.u_box_code = box.box_code AND smp.u_box_position = box.box_pos
SELECT smp.sample_id FROM ( SELECT sa.sample_id, sau.u_box_code, sau.u_box_position FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau WHERE sd.sdg_id = sdu.sdg_id AND sd.sdg_id = sa.sdg_id AND sa.sample_id = sau.sample_id AND sau.u_padded_out = 'F' AND sdu.u_client_type = decode('#Client#','-1',sdu.u_client_type,'#Client#') AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#') AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#') AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#') AND sd.status IN ('V','P','C') ) smp, ( SELECT box_code, trim(x.column_value.extract('e/text()')) box_pos FROM ( SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu WHERE pt.plate_template_id = p.plate_template_id AND p.plate_id = pu.plate_id AND pt.name = 'Box96' AND p.status IN ('V','P','C') AND p.description like '%NP=%' AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#') AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#') AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#') AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#') ) t, table (xmlsequence(xmltype('<e><e>' || replace(t.box_pos,',','</e><e>')|| '</e></e>').extract('e/e'))) x ) box WHERE smp.u_box_code = box.box_code
Hello
When 'LEVEL '.<= x"="" is="" the="" only="" connect="" by="" condition,="" then="" you="" should="" be="" using="" a="" table="" that="" has="" only="" one="" row,="" like="">=>
You can generate a Table of counters (a result set, in fact) who has all the integers that you need and then join one.
The next thread is an example:
I don't don't want to mark in plsql -
convert the string into individual components table
Hello Experts,
I would like to display an array of strings in a display of text/string. for example:
My array of strings is:
['I', 'L', 'O', 'V', 'E', 'L', 'A', 'B', 'V', 'I', 'E', 'W'], and I want to show this picture as I LOVE LABVIEW in an indicator of the string and not an indicator array.
How do I do that? I tried flatten to sting, but it added a lot of zero to the channel indicator, and the display is not only correct appearance.
I hope my question makes sense.
The functions of concatenate strings will do exactly what you want.
-
Parse the string using RegEx REMatch
Why is it not returns the variable form.item_cost equals: 199.99?
< CFSET string1 = "here, we have $199.99 is the price" > ".
< CFSET form.item_cost = ' #reMatchNoCase("^\d{0,4}(\.\d{1,2})?$",string1) # ">
I have only to search for the first prize, he sees in the string and returns this value in decimal digital form.
Because you anchor the regex for the beginning and the end of the string with ^ and $, you will match only if the string in its entirey is the number.
I recommend using the regex coach to test this kind of thing. It makes it very easy to work with this kind of thing out. http://www.Weitz.de/Regex-Coach/
--
Adam
-
Parse the string as an xml?
Hello
I want to do the following
InputSource is = new InputSource();is.setCharacterStream(new StringReader(xmlRecords))
But it seems that these methods are not available on the BB. What is the soapy foregoing?
InputStream inputStream = /* XML String */Document document = builder.parse( inputStream );
Thanks in advance
Wesley Trollip
ByteArrayInputStream bis = new ByteArrayInputStream (xmlString.getBytes("UTF-8"));
Doc document = builder.parse (bis);
-
Simple question: how to divide the string into multiple lines concatenated?
Hi people,
Maybe it's an easy question.
How to split a string that is concatenated into multiple lines by using the SQL query?
ENTRY:
Delimiter = ', '.select 'AAA,BBB,CC,DDDD' as data from dual
Expected results:
I'm looking for something nice to feature "an opposite to «sys_connect_by_path»»data ------------ AAA BBB CCC DDDD
Thank you
Tomaswith t as (select 'aaaa,,bbbb,cccc,dddd,eeee,ffff' as txt from dual) -- end of sample data select REGEXP_SUBSTR (txt, '[^,]+', 1, level) from t connect by level <= length(regexp_replace(txt,'[^,]*'))+1 REGEXP_SUBSTR(TXT,'[^,]+',1,LE ------------------------------ aaaa bbbb cccc dddd eeee ffff
-
SQL / PLSQL to split the string into pieces
Hi all
I have a problem of data conversion from the name of one table to another structure.
for example
SQL > desc names
Name Null? Type
----------------------------------------- -------- ----------------------------
TITLE VARCHAR2 (5)
FNAME VARCHAR2 (20)
LNAME VARCHAR2 (20)
SQL > Data desc
Name Null? Type
----------------------------------------- -------- ----------------------------
FULLNAME VARCHAR2 (50)
Insert in data values ("SIR I HAVE ONE NAME PARTICULARLY LONG INDEED");
Insert in the data values ("MINE IS EVEN MORE, ENOUGH RIDICULEMENT so IN FACT");
Essentially, I need to divide these names long, stored in the 1 field, in the above 3 fields. The trickiest part is however I want to do it in such a way so that if the 1st part of the name fits the 1 5 char field I want to do, otherwise I would divide between 2 fields - once again without splitting a string. The reason behind this is that application will automatically put a space between each field when they appear and I would avoid gaps in the names if possible.
This baffled me a little if any help would be seriously great... it might not even be a go-er, as it might be too uneconomic with the amount of available space, but I would give it a shot.
Thank you!
AdamHi, Adam.
Use regular expressions:
INSERT INTO names (title, fname, lname) SELECT RTRIM (REGEXP_SUBSTR ( fullname , '^.{1,5} ' ) ) , REGEXP_REPLACE ( fullname , '(^.{1,5} )?' || -- \1 = optional 1-5-letter word(s) '(.{1,20})' || -- \2 = 1-20 letters '(( .*)|$)' -- \3-\4 = space (plus anything) or end , '\2' ) , REGEXP_REPLACE ( fullname , '(^.{1,5} )?' || -- \1 = optional 1-5-letter word(s) '(.{1,20}( |$))' || -- \2-\3 = 1-20 letters and space or end '(.{1,20})?' || -- \4 = 0-20 letters '(( .*)|$)' -- \5 = space (plus anything) or end , '\4' ) FROM data_table -- data is not a good name ;
Published by: Frank Kulash, August 18, 2009 11:13
Revised to manage long single word fullname
Maybe you are looking for
-
Extend the warranty of Lenovo W540
I bought a Lenovo W540 on February 14, 2015 at the Portugal. It turns out that when I sign up by the "Lenovo Solution Center", I found that the registered warranty is may 2014 end June 28, 2017. I tried to change the date of purchase, but I can't fin
-
Write access restriction tab missing
I'm a bit confused, I have 2 routers wireless wrtg 56 g a v 1.0 and 1.1 v or has the 'access restricted' tab is shown in the manual and nor only accpets firmmware upgrade? Seems to be a bit fraudulent to announce something that does not exist. Being
-
How to capture the data of type string with agent script and then compared to an alarm
Hello... How to capture the string with agent of script data and then create a rule to compare the string data to generate alarm? Thank you!...
-
HelloI'm trying to follow a web page, be followed Drupal.The scripts have been properly downloaded and tests, Eloqua has also been a success. But when we try to check if the visits are actually followed, then it does not return a value any. For examp
-
I recently decided to drop my CC for LR and PS membership, I bought a self-sustaining disc and the license for LR6.I installed it properly leaving my CC LR existing in place. When the installation is complete, I tested and even edited a few files. No