Need help in converting string to numeric array
I am trying to convert a string to a numeric array ... the first # in the string gets cut off, the last three seem to come through.
This may be fairly simple, but I really haven't worked with the string functions all that much.
Help would be appreciated.
Thanks,
Attachments:
String to Array Example.vi 10 KB
Steve Chandler wrote:
If you remove the first and last byte from the string using string subset then the read spreadsheet string would probably have worked.
Yup.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
String to Array ExampleMOD2.vi 10 KB
Similar Messages
-
Needed help regarding converting string to java.sql.Date format
I have a a function which returns a calendar object. The date must be inserted to Oracle DB using java.sql.Date format.
So i have converted the Calendar object to java.sql.Date format using the following code
java.sql.Date publicationDate = new java.sql.Date(book.getPublicationDate().getTime().getTime());But while getting inserted into the DB it was in mm/dd/yyyy format whereas i wanted dd/mm/yyyy format
Can any body please help out how to store the date in dd/mm/yyyy format ?Can u please explain this a bit
This is my code
public int addBook(List<Book> BookList) throws SQLException, ParseException{
System.out.println("Hi there");
Book book = new Book();
BookDB bookDb = new BookDB();
//listLength = BookList.length;
String bookId = null;
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection("jdbc:oracle:thin:@10.123.79.195:1521:findb01","e115314", "e115314");
addBook = con.prepareStatement("insert into ABC_Book values(?,?,?,?,?,?,?)");
Iterator<Book> iterator = BookList.iterator();
while(iterator.hasNext()){
book = (Book)iterator.next();
System.out.println(book.getBookId());
addBook.setString(1,book.getBookId());
addBook.setString(2,book.getTitle());
addBook.setString(3,book.getAuthor());
addBook.setString(4,book.getPublisher());
System.out.println(book.getPublicationDate());
System.out.println("Before Date");
System.out.println("book.getPublicationDate().getTime()"+book.getPublicationDate().getTime());
java.sql.Date publicationDate = new java.sql.Date(book.getPublicationDate().getTime().getTime());
SimpleDateFormat formatter = new SimpleDateFormat("dd/mm/yyyy");
dateString = formatter.format(publicationDate);
System.out.println("Today is"+dateString);
java.sql.Date date = (java.sql.Date)formatter.parse(dateString);
System.out.println("date"+date);
//java.sql.Date publicationDate = (Date)book.getPublicationDate().getTime();
//System.out.println("Value of date is"+publicationDate);
System.out.println("After Date");
addBook.setDate(5,publicationDate);
addBook.setString(6,book.getCountry());
addBook.setString(7,book.getLanguage());
rs = addBook.executeQuery();
//con.commit();
rowCount = rowCount + rs.getRow();
return rowCount;
catch(SQLException se){
se.printStackTrace();
finally{
con.close();
System.out.println("After adding ");
return 0;
} -
I need help in converting a pdf to a fillable form in my adobe
I need help in converting a pdf to a fillable form in my adobe
"Adobe" is a company. If you mean "Adobe Reader" then you can't (at least not easily). You need Adobe Acrobat for that.
-
Need help in converting numbers to Italian text
Need help in converting numbers to text in Italian language. I want to knw is there any method other than SE63 to translate these text in one shot. I have tried with LSMW also (as the sheet is in XLS format ).Plz reply if anyone is aware of this ..
hi,
chk this code.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = amount
currency = 'EUR'
filler = ' '
language = 'E' => give the language as italian
IMPORTING
in_words = amountrs.
rgds
anver
pls mark all hlpful answers -
Need help in converting date format
Hi,
Need help in converting date format from 'DD-MON-YYYY' to 'YYYY-MM-DD' in an .rtf template as I believe xml publisher supports the date format as 'YYYY-MM-DD' only.
Thanks,
Raj.I got the same problem, anyone know how to solve this problem? I allready found some date functions on http://blogs.oracle.com/xmlpublisher/2008/09/date_functions.html . I also tried <?xdoxslt:month_name(xdoxslt:get_month(xdofx:substr(NEED_BY_DATE, 4,3)), $_XDOLOCALE), 0, 'nl-NL')?>, but then it returns a namespace error (Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.). Anyone know how to fix this?
Edited by: user11165753 on 7-dec-2009 23:50 -
Converting String to byte array
Hi,
There is a code for converting String to byte array, as follows:
public byte[] toByteArray(String s)
char[] c = s.toCharArray();
int len = c.length;
byte[] b = new byte[len * 2];
for ( int i = 0 ; i < len ; i++ )
b[i * 2] = (byte)(c);
b[(i * 2) + 1] = (byte)(c[i] >> 8);
return b;
But this isn't doing the conversion properly. For example, for the � (euro) symbol, it converts to some other unreadable symbol. Also, same is the case for square brackets. Any idea why this' so? What's wrong with the above code?
The encoding format is UTF-8.
Thanks.> In fact, I tried with String.getBytes() too, but leads to the same problem, with those specific symbols.
Did you try the String.getBytes(String charsetName) method?
Both methods have been around since Java 1.1.
It's an extremely important skill to learn to read the API and become familiar with the tools you will use to program Java. Java has an extensive set of online documentation that you can even download for your convenience. These "javadocs" are indexed and categorized so you can quickly look up any class or method. Take the time to consult this resource whenever you have a question - you'll find they typically contain very detailed descriptions and possibly some code examples.
Java� API Specifications
Java� 1.5 JDK Javadocs
Best of luck!
~ -
I need help to convert a string to date and time
Good aft,
1.How can i get a date from the user input thro' Frames?
2.How to parse it to the date object(I need to include java.util.Date but for the database i need to include java.sql.*,if i do so, i have error as
found:java.util.Date
Required:java.sql.Date)
3.How to insert into the database
The same i need help to insert time into database?
I need solution and explanation...
Reply me immediately...
If u send me the code, its better to me.Hello,
The best way is to use the HEX to decimal coversion VI in the string pallette. Then, write this decimal directly to your chart. If you are doing it a point at a time put it into a while loop.
Doug -
Need help with connecting file inputs to arrays
In this assignment I have a program that will do the following: display a list of names inputed by the user in reverse order, display any names that begin with M or m, and display any names with 5 or more letters. This is all done with arrays.
That was the fun part. The next part requires me to take the names from a Notepad file, them through the arrays and then output them to a second Notepad file.
Here is the original program: (view in full screen so that the code doesn't get jumbled)
import java.io.*; //Imports the Java library
class progB //Defines class
public static void main (String[] arguments) throws IOException
BufferedReader keyboard; //<-
InputStreamReader reader; // Allows the program to
reader = new InputStreamReader (System.in); // read the the keyboard
keyboard = new BufferedReader (reader); //<-
String name; //Assigns the name variable which will be parsed into...
int newnames; //...the integer variable for the amount of names.
int order = 0; //The integer variable that will be used to set the array size
String[] array; //Dynamic array (empty)
System.out.println (" How many names do you want to input?"); //This will get the number that will later define the array
name = keyboard.readLine ();
newnames = Integer.parseInt (name); // Converts the String into the Integer variable
array = new String [newnames]; //This defines the size of the array
DataInput Imp = new DataInputStream (System.in); //Allows data to be input into the array
String temp;
int length; //Defines the length of the array for a loop later on
for (order = 0 ; order < newnames ; order++) //<-
{ // Takes the inputed names and
System.out.println (" Please input name "); // gives them a number according to
temp = keyboard.readLine (); // the order they were inputed in
array [order] = temp; //<-
for (order = newnames - 1 ; order >= 0 ; order--) //<-
{ // Outputs the names in the reverse
System.out.print (" \n "); // order that they were inputed
System.out.println (" Name " + order + " is " + array [order]); //<-
for (order = 0 ; order < newnames ; order++) //<-
if (array [order].startsWith ("M") || array [order].startsWith ("m")) // Finds and outputs any and all
{ // names that begin with M or m
System.out.print (" \n "); //
System.out.println (array [order] + (" starts with M or m")); //
} //<-
for (order = 0 ; order < newnames ; order++) //<-
length = array [order].length (); //
if (length >= 5) // Finds and outputs names
{ // with 5 or more letters
System.out.print (" \n "); //
System.out.println ("Name " + array [order] + " have 5 or more letters "); //<-
}The notepad file contains the following names:
jim
laruie
tim
timothy
manny
joseph
matty
amanda
I have tried various methods but the one thing that really gets me is the fact that i can't find a way to connect the names to the arrays. Opening the file with FileInputStream is easy enough but using the names and then outputing them is quite hard. (unless i'm thinking too hard and there really is a simple method)By "connect", do you just mean you want to put the names into an array?
array[0] = "jim"
array[1] = "laruie"
and so on?
That shouldn't be difficult at all, provided you know how to open a file for reading, and how to read a line of text from it. You can just read the line of text, put it in the array position you want, until the file is exhausted. Then open a file for writing, loop through the array, and write a line.
What part of all that do you need help with? -
I need help with error ORA-06502: numeric or value error
Hi, all, i need help finding the error here, im getting a numeric or value error when i add information to the variable vlcadena when vlcadena is a clob type, and i check the length of the vlcadena variable and sometimes makes the error at 8000 characters some other times 32k i have no idea whats happening, does anyone have a clue?
PROCEDURE REGISTRO_551 (
VPNUMPARTE IN PARTESC.NUMPARTE%TYPE,
VPFRACCION IN IMPOMAT.FRACCIONMEXIMPO%TYPE,
VPDESCRIPCION IN PARTESC.DESCESPANOL%TYPE,
VPVALORDLS IN IMPOMAT.VALORDOLARES%TYPE,
VPCANTIDAD IN IMPOMAT.CANTIDAD%TYPE,
VPUNIMED IN PARTESC.UNIMEDPARTE%TYPE,
VPCANTIDADTARIFA IN IMPOMAT.CANTIDAD%TYPE,
VPVALORAGREGADO IN EXPOPT.VALORAGREGADO%TYPE,
VPPAISORIGEN IN PARTESC.PAISORIGEN%TYPE,
VPCOMPVEND IN PARTESC.PAISORIGEN%TYPE,
VPTIPOFRACCION IN IMPOMAT.TIPOFRACCION%TYPE,
VPPESONETO IN IMPOMAT.PESONETO%TYPE,
VPTIPOMONEDA IN MIMPOMAT.TIPOMONEDAEXTRANJERA%TYPE
) AS
BEGIN
vgproceso := 207310;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||'551'||'|'; --1. TIPO DE REGISTRO
vgproceso := 207311;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||VPFRACCION||'|'; --2. FRACCION
vgproceso := 207312;
vllong2:=length(vlCadena);
QUITA_ENTERS(NVL(VPDESCRIPCION,' '),VLTEMP);
IF LENGTH(VLTEMP)>80 THEN
VLTEMP:=SUBSTR(VLTEMP,1,80);
END IF;
vgproceso := 207313;
vllong2:=length(vlCadena);
IF VLTEMP IS NULL THEN
vlCadena:=vlCadena||'|'; --3. DESCRIPCION
ELSE
vlCadena:=vlCadena||VLTEMP||'|'; --3. DESCRIPCION
END IF;
vgproceso := 207314;
vllong2:=length(vlCadena);
IF VPNUMPARTE IS NULL THEN
vlCadena:=vlCadena||'|';--4. NO. DE PARTE
ELSE
vlCadena:=vlCadena||VPNUMPARTE||'|';--4. NO. DE PARTE
END IF;
vgproceso := 207315;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||VPVALORDLS||'|'; --5. VALOR MERCANCIA
vgproceso := 207316;
vllong2:=length(vlCadena);
vlCadena:=vlCadena||VPCANTIDAD||'|'; --6. CANTIDAD COMERCIAL
vgproceso := 207317;
vllong2:=length(vlCadena);
IF VPUNIMED IS NULL THEN
VPDESCERROR:='ALGUNA PARTIDA CON FRACCION '||VPFRACCION||' NO TIENE UNIDAD DE MEDIDA';
END IF;
vgproceso := 207320;
GET_CATGRAL('ADUANAS','UNIMED',NVL(VPUNIMED,' '),CL_D1,CL_D2,CL_D3,CL_D4,CL_V1,CL_V2,CL_V3,CL_CATG);
IF CL_V2=0 THEN
vlCadena:=vlCadena||VPUNIMED||'|'; --7. UNIDAD MEDIDA COMERCIAL
ELSE
SELECT TO_CHAR(TRUNC(CL_V2)) INTO VLUMCOMERCIAL FROM DUAL;
IF LENGTH(VLUMCOMERCIAL)=1 THEN
VLUMCOMERCIAL:='0'||VLUMCOMERCIAL;
END IF;
vlCadena:=vlCadena||VLUMCOMERCIAL||'|'; --7. UNIDAD MEDIDA COMERCIAL
END IF;
vlCadena:=vlCadena||VPCANTIDADTARIFA||'|';--8. CANTIDAD TARIFA
vlCadena:=vlCadena||VPVALORAGREGADO||'|';--9. VALOR AGREGADO
GET_CATGRAL('ADUANAS','CONFADU','IVIN-REG',CL_D1,CL_D2,CL_D3,CL_D4,CL_V1,CL_V2,CL_V3,CL_CATG);
vlCadena:=vlCadena||CL_D1||'|'; --10. VINCULACION
vlCadena:=vlCadena||CL_D2||'|'; --11. METODO DE VALORACION
vlCadena:=vlCadena||'|'; --12. MARCA
vlCadena:=vlCadena||'|'; --13. MODELOIf the expected maximum length of the concatenated string is less than 32K, then use VARCHAR2 and at the end convert to CLOB if necesary.
:p
PS: At what line in the code does it give the error?
Edited by: LKBrwn_DBA on Aug 20, 2009 2:49 PM -
Hi..
Need some help on how to go about converting a given string into an array. I belive there is a way in java to chop the string into chars and then feed the chars into an array. Anyone that can help me out on what methods to look for?Hi ,
Did you get answer of your query If yes then pls send
me the code at my e-mail id
[email protected]
I will be thankful to you
Regds,
SureshSomeone else who likes to get info on breast implants and penis extensions in their email account. -
Hi, I need help. I have several groups of data for input, and need to use them later in the same or different code. When I key in the input data, the code will ask the number of data group first, then in each group, there will be 6 data to key in, each has a specific variable name. The number of group and the data for each group will vary at each time running the code. The data group needs to be numbered sequently. After having all groups of data, these data will be sent to another sub VI to read. This sub VI needs to know each group number and each data of a group.
I think I should create a 2-D array to read these data in a do loop, but I can't let my do loop read data in each time. Then when I sent the data out, the next sub VI was confused by the sequence of the data group and the sequence of data in each group. Can someone help me or give me some example how to do it? Thank you very much for your help.
Message Edited by ccyang on 06-06-2006 10:37 AMFrom what I understand of your explanation, an event structure might be
the way to go (LV 6+ I think). Events could be based off of
keypresses in a particular control (a 2D array like you mentioned), and
once input in that particular field is complete, the user presses say
the 'enter' key, and you can use the "VKey" of the event data node to
determine which key is pressed (i.e. VKey = enter?). From there,
you would continue to the next portion of data entry or processing of
entered information.
Hope this helps. -
Need help in the String Format method
really need help in string.Format method. I would like to show the s in two digit numbers.
for example:
if s is below 10 then display *0s*
the expecting result is 01,02,03.. 09,10,11....
I tried this method, somehow i got the errors msg. pls advise. thx.
public void setDisplay(String s) {
String tmpSS=String.format("%02d",s);
this.ss.setText(tmpSS);
Edited by: bluesailormoon on May 19, 2008 10:30 AMApparently, you expect the string to consist of one or two digits. If that's true, you could do this:String tmpSS = (s.length() == 1) ? ("0" + s) : s; or this: String tmpSS = String.format("%02d", Integer.parseInt(s));
-
Need help to convert SQL MSSQL statement to work with PL in ORACLE
Hi All,
I have the trigger below and it worked on MSSQL server for windown and
I really need your help to convert this trigger to work on PL/ORACLE:
create trigger deleteLD
on tablea for delete
as
set nocount on
begin
declare @tablename varchar(100)
declare @dropSql varchar(50)
select @tablename= dataset from deleted
set @tablename = 'LD_' + @tablename
set @tablename = @tablename + 'UTMSTATS'
if exists (select * from sysobjects where name = @tablename)
begin
set @tablename = 'drop table ' + @tablename
EXEC (@tablename)
end
end
GO
Your help is greatly appreciated.
Thanks,
JPnot sure if this is something that you want:
Create Or Replace Trigger deleteLD
Before Delete on tablea
Declare
vCtr number := 0;
Begin
select count(*)
into vCtr
from all_tables
where table_name = :new.tablename;
if vCtr > 0 then
dbms_utility.exec_ddl_statement('drop table '||:new.table_name);
end if;
End;note: not tested -
I need help to convert hours,minutes and seconds to seconds.
Hi, I need help with the code on how to convert the hours,minutes and seconds to seconds. I don't know which formula to use so that I can get the results in total number of seconds. Thanks.
Jos ("when in doubt: parenthesize correctly")Bracist.You're more right than you'd known: last week I climbed over a safety
fence (which I wasn't supposed to do of course) to adjust the position
of an optical measurement device we installed in a huge production
machine in a factory. I stepped on some sort of hose; the end of that
hose broke loose and hit me straight in the middle of my lower jaw. My
front teeth feel wiggly now and my molars on the left of my lower jaw are
not what they used to be. This Wednesday I get that all fixed at some
dental clinic. Keep your fingers crossed because me+dentists == war.
My tongue continuously keeps on reporting craters and disaster ;-)
Jos, how's it going? Besides a possible loss of some teeth, I'm fine ;-)
My Spring/Hibernate journey continues. I'm trying out Hibernate 3.2
annotations and the Ant tools. So far, so good.Good to hear. At the moment I'm putting my teeth (sic) in that darn snmp
stuff which simply refuses to work the way I want it and besides that I'm
heavily involved in some of that SAP stuff. Spring is not in the vicinity for
me in the next couple of months sadly enough.
kind regards,
Jos -
I need help to convert photos in the .swf format to a format that will open on iOS
I need help converting photos in the .swf format to a format that will work on my Mac. Thanks
SWF is a Flash file that should be able to be opened with your web browser on your Mac. Probably not on iOS though.
You will likely need to find the source file for the application that created the SWF and the image will be in that. You could then export/extract the image and have it as a stand alone file.
It does look like there are applications that can do what you are looking for though: https://www.google.com/search?q=SWF+to+JPG
Maybe you are looking for
-
Backup management: how to update a Time Machine backup on a different Mac?
Hello everyone, I need some advice. I have a question, which I think is simple, but my situation is a bit complicated, so I am not sure about what to do. I will try to describe it as simply as possible. There are 3 macs: A: an old macbook (the white
-
Older version of Aperture not working on New MacBook Pro
Hi there I have a new Mac Book and my version of Aperture wont run. I successfully installed it and have run all updates but still no joy. I get the message 'You can't use this version of the application aperture with this version of the Mac OS X' 'Y
-
HT204053 How can I find my secerity password on my apple id accr
I'm having a problem trying to download my apps from my phone and it want let. Me unless I have a 4 digit secerity password
-
Files newly added in system after having opened firefox are not visible for attachments
if firefox is alrady running & new file is being added to the system,the same is not visible for attaching the file in gmail. what must be the issue?
-
How to delete someone in iPhoto ?
I want to keep the photos where they appear, but I don't want to see Michael & Marine either in iPhoto. How to do this ? Moving their folder to the trash doesn't work